Using C# program I am reading CSV File with value like (Name, Salary, Age) (A, $1,200, 27) (B, 2300, 27)
In the header row there are three columns. I want to validate that the number of columns in data rows is also three. (C, 28) should be an invalid file.
Currently I am doing this by counting the number of commas. But when the content itself is having comma ($1,200), this logic is failing. How do I solve this issue?