Sunday 30 November 2014

C# Read CSV

var lineCount = System.IO.File.ReadLines(@"123.csv").Count();
var reader = new StreamReader(System.IO.File.OpenRead(@"123.csv"));
            for (int i = 0; i < lineCount; i++)
            {
                var line = reader.ReadLine();
                var values = line.Split(',');
                string value1 = values[0];
                string value2 = values[1];
  /* deal with it */
 
            }

No comments:

Post a Comment