I have a CSV file that I want to read into a List. Here\'s an example file:
Plant,Material,\"Density, Lb/ft3\",Storage Location
FRED,10000477,64.3008,3300
F
You can use a simple code like this, which ignores the header and doesn't work with quotes, but may be sufficient for your needs.
from line in File.ReadAllLines(fileName).Skip(1)
let columns = line.Split(',')
select new
{
Plant = columns[0],
Material = int.Parse(columns[1]),
Density = float.Parse(columns[2]),
StorageLocation = int.Parse(columns[3])
}
Or you can use a library, like others suggested.