我是使用FileHelpers类解析CSV的新手。我有一个像这样的文件...

    "background","Info","Agent abcdefg
    ===================
    Context Tenant: {Vendor: 1, Customer: 719046046}","2,140.69","","7/11/2017 3:30 AM"


我想忽略任何换行符,而是将其作为一个字符串读取。你能帮忙吗?

所以在该行的末尾是\ r \ n,我希望将其删除。

最佳答案

您可以这样使用[FieldQuoted]

public class YourRecordClass
{
  [FieldQuoted()]
  public string Field1;

  [FieldQuoted()]
  public string Field2;

  [FieldQuoted(QuoteMode.OptionalForBoth, MultiLineMode.AllowForBoth)]
  public string Field3;

  [FieldQuoted()]
  public string Field4;

  [FieldQuoted()]
  public string Field5;

  [FieldQuoted()]
  public string Field6;
}

关于c# - 忽略FileHelpers C#中的字段内的NewLIne,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/45300079/

10-09 22:12