[Solved] parse a csv file in C#


I don’t think iterating through the items is a good idea if you just have split it before. I would change your code like that:

string valuesString = File.ReadAllText(@"C:/Users/state.csv");
Console.WriteLine(valuesString);
String[] values = valuesString.Split(',');

This way you will split this string only once. If you want to extend the buffer of the console, you should do

Console.BufferHeight = Int16.MaxValue - 1; 

4

solved parse a csv file in C#