【问题标题】:QuoteString & DoubleQuoteString Replacement引用字符串和双引号字符串替换
【发布时间】:2023-03-23 12:12:01
【问题描述】:

使用 CsvHelper 20.0.0WriterConfiguration.QuoteStringWriterConfiguration.DoubleQuoteString 已被删除。

我依靠这些字段来实现 UseExcelLeadingZerosFormatForNumerics,如 here 所示。

我可以通过其他方式访问QuoteStringDoubleQuoteString吗?

【问题讨论】:

    标签: c# .net csvhelper


    【解决方案1】:

    您可以将QuoteString 替换为configuration.Quote.ToString(),将DoubleQuoteString 替换为new String(configuration.Quote, 2)

    【讨论】:

    • 谢谢!有没有办法替换Context.Record.Add(field)?看起来WriteField 的实现已更改为依赖私有成员
    • @James 我没看到CsvContext.Record?不知道Context 你是什么意思...
    • 对不起,我指的是这个代码示例:stackoverflow.com/a/54556903/10023098
    • @James 看来新的 CsvHelper 在性能上有很多变化;我建议根据CsvWriter.WriteField 的当前版本的源代码重新编写代码示例。或者也许就如何重写该示例提出一个单独的问题。
    猜你喜欢
    • 1970-01-01
    • 2017-08-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-07
    • 2011-12-07
    • 1970-01-01
    相关资源
    最近更新 更多