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
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
BufferSize
Gets the size of the buffer used for parsing and writing CSV files. Default is 0x1000.
int BufferSize { get; }
Property Value
CacheFields
Cache fields that are created when parsing. Default is false.
bool CacheFields { get; }
Property Value
Comment
Gets the character used to denote a line that is commented out. Default is '#'.
char Comment { get; }
Property Value
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
CultureInfo
Gets the culture info used to read an write CSV files.
CultureInfo CultureInfo { get; }
Property Value
Delimiter
The delimiter used to separate fields. Default is ListSeparator.
string Delimiter { get; }
Property Value
DetectDelimiter
Detect the delimiter instead of using the delimiter from configuration.
Default is false
.
bool DetectDelimiter { get; }
Property Value
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
Escape
The character used to escape characters. Default is '"'.
char Escape { get; }
Property Value
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
GetDelimiter
Gets the function that is called when DetectDelimiter is enabled.
GetDelimiter GetDelimiter { get; }
Property Value
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
IsNewLineSet
A value indicating if NewLine was set.
bool IsNewLineSet { get; }
Property Value
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
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
Mode
The mode. See CsvMode for more details.
CsvMode Mode { get; }
Property Value
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
ProcessFieldBufferSize
The size of the buffer used when processing fields. Default is 1024.
int ProcessFieldBufferSize { get; }
Property Value
Quote
Gets the character used to quote fields. Default is '"'.
char Quote { get; }
Property Value
TrimOptions
Gets the field trimming options.
TrimOptions TrimOptions { get; }
Property Value
WhiteSpaceChars
Characters considered whitespace. Used when trimming fields. Default is [' '].
char[] WhiteSpaceChars { get; }
Property Value
- char[]
Methods
Validate()
Validates the configuration.
void Validate()