Table of Contents

Interface IParserConfiguration

Namespace
CsvHelper.Configuration
Assembly
CsvHelper.dll

Configuration used for the IParser.

public interface IParserConfiguration

Properties

AllowComments

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

bool AllowComments { get; }

Property Value

bool

BadDataFound

Gets the function that is called when bad field data is found. A field has bad data if it contains a quote and the field is not quoted (escaped). You can supply your own function to do other things like logging the issue instead of throwing an exception.

BadDataFound? BadDataFound { get; }

Property Value

BadDataFound

BufferSize

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

int BufferSize { get; }

Property Value

int

CacheFields

Cache fields that are created when parsing. Default is false.

bool CacheFields { get; }

Property Value

bool

Comment

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

char Comment { get; }

Property Value

char

CountBytes

Gets a value indicating whether the number of bytes should be counted while parsing. Default is false. This will slow down parsing because it needs to get the byte count of every char for the given encoding. The Encoding needs to be set correctly for this to be accurate.

bool CountBytes { get; }

Property Value

bool

CultureInfo

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

CultureInfo CultureInfo { get; }

Property Value

CultureInfo

Delimiter

The delimiter used to separate fields. Default is ListSeparator.

string Delimiter { get; }

Property Value

string

DetectDelimiter

Detect the delimiter instead of using the delimiter from configuration. Default is false.

bool DetectDelimiter { get; }

Property Value

bool

DetectDelimiterValues

The possible delimiter values used when detecting the delimiter. Default is [",", ";", "|", "\t"].

string[] DetectDelimiterValues { get; }

Property Value

string[]

Encoding

Gets the encoding used when counting bytes.

Encoding Encoding { get; }

Property Value

Encoding

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

GetDelimiter

Gets the function that is called when DetectDelimiter is enabled.

GetDelimiter GetDelimiter { get; }

Property Value

GetDelimiter

IgnoreBlankLines

Gets a value indicating if blank lines should be ignored when reading. true to ignore, otherwise false. Default is true.

bool IgnoreBlankLines { get; }

Property Value

bool

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.

LineBreakInQuotedFieldIsBadData

Gets a value indicating if a line break found in a quote field should be considered bad data. true to consider a line break bad data, otherwise false. Defaults to false.

bool LineBreakInQuotedFieldIsBadData { get; }

Property Value

bool

MaxFieldSize

Gets or sets the maximum size of a field. Defaults to 0, indicating maximum field size is not checked.

double MaxFieldSize { get; }

Property Value

double

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

ProcessFieldBufferSize

The size of the buffer used when processing fields. Default is 1024.

int ProcessFieldBufferSize { get; }

Property Value

int

Quote

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

char Quote { get; }

Property Value

char

TrimOptions

Gets the field trimming options.

TrimOptions TrimOptions { get; }

Property Value

TrimOptions

WhiteSpaceChars

Characters considered whitespace. Used when trimming fields. Default is [' '].

char[] WhiteSpaceChars { get; }

Property Value

char[]

Methods

Validate()

Validates the configuration.

void Validate()