Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ignore NewLIne inside a field in FileHelpers C#

I am fairly new using FileHelpers Class for parsing the CSV. I have a file like this...

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

I would like to ignore any newline and would like to read that as one string. Can you please help?

so at the end of the line it is \r\n and i want this to be removed.

like image 879
Mahesh Avatar asked Jan 27 '26 01:01

Mahesh


1 Answers

You can use [FieldQuoted] like this:

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;
}
like image 141
Marcos Meli Avatar answered Jan 29 '26 13:01

Marcos Meli