时间 | 降雨mm | 蒸发mm | 流量m3/s |
2013-01-01 | 10 | 0.1 | 50 |
2013-01-02 | 11 | 0.2 | 60 |
2013-01-03 | 12 | 0.3 | 70 |
2013-01-04 | 13 | 0.4 | 80 |
2013-01-05 | 14 | 0.5 | 90 |
用 https://github.com/JoshClose/CsvHelper, 设置分隔符为空格, 直接把数据映射为class中的property
public class MyClass
{
public DateTime Date{get;set;}
public int Rain {get;set;}
public float V {get;set;}
pubic int F {get;set;}
}
var csv = new CsvReader(textReader);
var records = csv.GetRecords<MyClass>();