I use linq to load the csv file, but since csv can have any number of columns, the returned object will have dynamic properties, and I cannot figure out how to do this.
var data = from row in csvData
let col = row.Split(',')
select new
{
Field1 = data[0],
Field2 = data[1],
Field3 = data[2]
};
If possible, I would like to name the properties by the name specified in the csv file, and not in field1, field2, etc.
Thank!
source
share