I have a CSV file which looks like this basically:
TransactionID ProfileID Date // more columns here...
somevalue 1231231
The header is still to skip in this code, but with this code, you can choose which columns to extract. It might be much faster if you use a StreamReader. And you will need a constructor for your object.
var temp = File.ReadAllLines(@"C:\myFile.csv");
public List() myExtraction = new List();
foreach(string line in temp)
{
var delimitedLine = line.Split('\t'); //set ur separator, in this case tab
myExtraction.Add(new MyMappedCSVFile(delimitedLine[0], delimitedLine[3]));
}
Code for your Object:
public class MyMappedCSVFile
{
public string ProfileID { get; set; }
public string Date { get; set; }
public MyMappedCSVFile(string profile, string date)
{
ProfileID = profile;
Date = date;
}
}