Table of Contents

Interface IWriterConfiguration

Namespace
CsvHelper.Configuration
Assembly
CsvHelper.dll

Configuration used for the IWriter.

public interface IWriterConfiguration

Properties

AllowComments

Gets a value indicating if comments are allowed. True to allow commented out lines, otherwise false.

bool AllowComments { get; }

Property Value

bool

BufferSize

Gets the size of the buffer used for parsing and writing CSV files. Default is 0x1000.

int BufferSize { get; }

Property Value

int

Comment

Gets the character used to denote a line that is commented out. Default is '#'.

char Comment { get; }

Property Value

char

CultureInfo

Gets the culture info used to read and write CSV files.

CultureInfo CultureInfo { get; }

Property Value

CultureInfo

Delimiter

Gets the delimiter used to separate fields. Default is ',';

string Delimiter { get; }

Property Value

string

DynamicPropertySort

Gets the comparer used to order the properties of dynamic objects when writing. The default is null, which will preserve the order the object properties were created with.

IComparer<string>? DynamicPropertySort { get; }

Property Value

IComparer<string>

Escape

The character used to escape characters. Default is '"'.

char Escape { get; }

Property Value

char

ExceptionMessagesContainRawData

A value indicating if exception messages contain raw CSV data. true if exception contain raw CSV data, otherwise false. Default is true.

bool ExceptionMessagesContainRawData { get; }

Property Value

bool

HasHeaderRecord

Gets a value indicating if the CSV file has a header record. Default is true.

bool HasHeaderRecord { get; }

Property Value

bool

IgnoreReferences

Gets a value indicating whether references should be ignored when auto mapping. True to ignore references, otherwise false. Default is false.

bool IgnoreReferences { get; }

Property Value

bool

IncludePrivateMembers

Gets a value indicating if private member should be read from and written to. True to include private member, otherwise false. Default is false.

bool IncludePrivateMembers { get; }

Property Value

bool

InjectionCharacters

Gets the characters that are used for injection attacks.

char[] InjectionCharacters { get; }

Property Value

char[]

InjectionEscapeCharacter

Gets the character used to escape a detected injection.

char InjectionEscapeCharacter { get; }

Property Value

char

InjectionOptions

Gets the injection options.

InjectionOptions InjectionOptions { get; }

Property Value

InjectionOptions

IsNewLineSet

A value indicating if NewLine was set.

bool IsNewLineSet { get; }

Property Value

bool

true if NewLine was set. false if NewLine is the default.

MemberTypes

Gets the member types that are used when auto mapping. MemberTypes are flags, so you can choose more than one. Default is Properties.

MemberTypes MemberTypes { get; }

Property Value

MemberTypes

Mode

The mode. See CsvMode for more details.

CsvMode Mode { get; }

Property Value

CsvMode

NewLine

The newline string to use. Default is \r\n (CRLF). When writing, this value is always used. When reading, this value is only used if explicitly set. If not set, the parser uses one of \r\n, \r, or \n.

string NewLine { get; }

Property Value

string

Quote

Gets the character used to quote fields. Default is '"'.

char Quote { get; }

Property Value

char

ReferenceHeaderPrefix

Gets a callback that will return the prefix for a reference header.

ReferenceHeaderPrefix? ReferenceHeaderPrefix { get; }

Property Value

ReferenceHeaderPrefix

ShouldQuote

Gets a function that is used to determine if a field should get quoted when writing.

ShouldQuote ShouldQuote { get; }

Property Value

ShouldQuote

TrimOptions

Gets the field trimming options.

TrimOptions TrimOptions { get; }

Property Value

TrimOptions

UseNewObjectForNullReferenceMembers

Gets a value indicating that during writing if a new object should be created when a reference member is null. True to create a new object and use it's defaults for the fields, or false to leave the fields empty for all the reference member's member.

bool UseNewObjectForNullReferenceMembers { get; }

Property Value

bool

Methods

Validate()

Validates the configuration.

void Validate()