【发布时间】:2020-07-24 14:45:40
【问题描述】:
我有一个与 CsvHelper 库相关的问题,我不知道如何将 csv 文件映射到以下 Mycalss 对象。 csv 文件如下所示:
id, Property1, property2....
1, x, a,b,c
2,x, d,f
3, y, g,h,i,j,k
...
我想解析为以下类
public class MyClass
{
public string Id { get; set; }
public List<Custom> MyCustoms { get; set; }
}
public class Custom
{
public string Property1 { get; set; }
public List<string> Property2 { get; set; }
}
【问题讨论】: