Search code examples
.netfilehelpers

Filehelpers - Export with double quotes around each field


This is one of those things that I'm sure is really easy, but I can't seem to work it out!

Using FileHelpers, how do I make sure that every field in my export contains double quotes? I'm guessing there's an attribute I can put over each field I want to have double quotes around it but I can't see where it is.

Thanks


Solution

  • Decorate your fields with FieldQuotedAttribute using one of the available constructors that allow you to specify a QuoteMode. For example:

    [FieldQuoted('"', QuoteMode.AlwaysQuoted)]