更新时间:2023-12-02 22:48:46
您可以使用一个简单的code这样的,它忽略了头,不带引号工作,但可能会为您的需求是足够的。
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.