Writing a Header using CsvHelper? C#

后端 未结 2 1781
一生所求
一生所求 2020-12-03 22:09

I\'m using CsvHelper. To write to a .csv file, I need a header based off of a class.

I write the header manually and it works, but I need to be done aut

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-03 22:59

    I believe this exception is from the CsvReader and not the CsvWriter. Default CsvConfiguration expects a header and uses AutoMap to generate a PropertyName_to_Index mapping.

    From the documentation you may need to define a map see mapping

提交回复
热议问题