【发布时间】:2020-07-03 19:07:59
【问题描述】:
我正在使用 CsvHelper 库将数据导出到 CSV。我在为嵌套列表对象创建地图时遇到了困难。
public class Level1
{
public int Prop1 { get; set; }
public string Prop2 { get; set; }
public Level2 Level2 { get; set; }
}
public class Level2
{
public int Prop3 { get; set; }
public string Prop4 { get; set; }
public List<Level3> Level3 { get; set; }
}
public class Level3
{
public int Prop5 { get; set; }
}
作为 csv 的输出,想要的是:
Prop1,Prop2,Prop3,Prop4,Level3
1 ,test ,2 , LL, , <list as ; separated>
谁能帮助我使用 CsvHelper 库创建地图?
【问题讨论】:
标签: c# .net export-to-csv csvhelper