【发布时间】:2021-02-14 20:08:03
【问题描述】:
CSVHelper v23 中的重大更改包括“所有委托现在都接受一个结构参数”。 PrepareHeaderForMatch 就是这些代表之一。我收到一个编译错误“Delegate 'PrepareHeaderForMatch' does not take 2 arguments”。
对于这个基本问题,我很抱歉,但我不确定如何在我的代码中修复 PrepareHeaderForMatch。我确信这很简单,但我在网上找不到任何示例或帮助。也许这篇文章将来会对其他人有所帮助。
var csvConfig = new CsvConfiguration(CultureInfo.CurrentCulture)
{
HeaderValidated = null,
MissingFieldFound = null,
PrepareHeaderForMatch = (string header, int index) => header.ToLower() // Match header and property names after converting to lower case
};
【问题讨论】:
标签: csvhelper