using Microsoft.VisualBasic; using Microsoft.VisualBasic.FileIO;
...
TextFieldParser parser = new TextFieldParser(@"pathToCSVFile");
parser.TextFieldType = Microsoft.VisualBasic.FileIO.FieldType.Delimited;
parser.SetDelimiters(",");
while (!parser.EndOfData)
{
string[] cols = parser.ReadFields();
foreach (string col in cols)
{
Do something with the info in each field...
}
}
To make a long story short, this existing Microsoft object will make your life a heck of a lot easier since it tends to handle most scenarios that would require special coding (i.e. properly handling quotes).



