Class Options
A set of options for reading and writing CSV files.
Combine with Configuration to bind to a particular type in a IBoundConfiguration(T) which can create readers and writers.
Inheritance
Implements
Namespace: Cesil
Assembly: Cesil.dll
Syntax
public sealed class Options : Object, IEquatable<Options>
Fields
Default
Default options:
- separator = ,
- automatically detects row endings when reading
- when writing, row endings = \r\n
- escaped columns start = "
- escape character = "
- detects headers when reading
- writes headers
- uses the default type describer
- uses MemoryPoolProviders.Default
- uses the default write buffer size
- does not write a new line after the last row
- does not support comments
- uses the default read buffer size
- dynamic rows are disposed when the reader that returns them is disposed
- whitespace is preserved
- extra columns are ignored
- uses ArrayPool.Shared
Declaration
public static readonly Options Default
Field Value
Type | Description |
---|---|
Options |
DynamicDefault
Default options for dynamic operations:
- separator = ,
- automatically detects row endings when reading
- when writing, row endings = \r\n
- escaped columns start = "
- escape character = "
- assumes headers are present
- writes headers
- uses the default type describer
- uses MemoryPoolProviders.Default
- uses the default write buffer size
- does not write a new line after the last row
- does not support comments
- uses the default read buffer size
- dynamic rows are disposed when the reader that returns them is disposed
- extra columns are included, accessible via index
Declaration
public static readonly Options DynamicDefault
Field Value
Type | Description |
---|---|
Options |
Properties
CommentCharacter
Which character, if any, is used to indicate the start of a comment.
Typically not set, but when set often '#'.
Declaration
public Nullable<char> CommentCharacter { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Char> |
DynamicRowDisposal
When to dispose any dynamic rows returned by an IReader or IAsyncReader.
Declaration
public DynamicRowDisposal DynamicRowDisposal { get; }
Property Value
Type | Description |
---|---|
DynamicRowDisposal |
EscapedValueEscapeCharacter
Character used to escape another character in an escaped value.
Typically a double quote, but can be null for some formats and will be null for formats without an EscapedValueStartAndEnd.
Declaration
public Nullable<char> EscapedValueEscapeCharacter { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Char> |
EscapedValueStartAndEnd
Character used to start an escaped value.
Typically a double quote, but can be null for some formats.
Declaration
public Nullable<char> EscapedValueStartAndEnd { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Char> |
ExtraColumnTreatment
How to handle extra colums encountered when reading a CSV.
Declaration
public ExtraColumnTreatment ExtraColumnTreatment { get; }
Property Value
Type | Description |
---|---|
ExtraColumnTreatment |
MemoryPoolProvider
Provider for MemoryPools needed during reading or writing CSVs.
Declaration
public IMemoryPoolProvider MemoryPoolProvider { get; }
Property Value
Type | Description |
---|---|
IMemoryPoolProvider |
ReadBufferSizeHint
How big a buffer to request from the MemoryPool for servicing read operations.
Set to 0 to use a default size.
Declaration
public int ReadBufferSizeHint { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
ReadHeader
Whether or not to read headers when reading a CSV.
Declaration
public ReadHeader ReadHeader { get; }
Property Value
Type | Description |
---|---|
ReadHeader |
ReadRowEnding
The sequence of characters used to end a row when reading.
Declaration
public ReadRowEnding ReadRowEnding { get; }
Property Value
Type | Description |
---|---|
ReadRowEnding |
TypeDescriber
The instance of ITypeDescriber that will be used to discover which columns to read or write, as well as the manner of their reading and writing.
Declaration
public ITypeDescriber TypeDescriber { get; }
Property Value
Type | Description |
---|---|
ITypeDescriber |
ValueSeparator
Character used to separate two values in a row
Typically a comma.
Declaration
public string ValueSeparator { get; }
Property Value
Type | Description |
---|---|
System.String |
WhitespaceTreatment
How to handle whitespace when encountered during parsing.
Declaration
public WhitespaceTreatments WhitespaceTreatment { get; }
Property Value
Type | Description |
---|---|
WhitespaceTreatments |
WriteBufferSizeHint
How big a buffer to request from the MemoryPool for buffering write operations.
Set to 0 to disable buffering.
Set to null to use a default size.
Declaration
public Nullable<int> WriteBufferSizeHint { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Int32> |
WriteHeader
Whether or not to write headers when writing a CSV.
Declaration
public WriteHeader WriteHeader { get; }
Property Value
Type | Description |
---|---|
WriteHeader |
WriteRowEnding
The sequence of characters used to end a row when writing.
Declaration
public WriteRowEnding WriteRowEnding { get; }
Property Value
Type | Description |
---|---|
WriteRowEnding |
WriteTrailingRowEnding
Whether or not to write a row ending after the last row in a CSV.
Declaration
public WriteTrailingRowEnding WriteTrailingRowEnding { get; }
Property Value
Type | Description |
---|---|
WriteTrailingRowEnding |
Methods
CreateBuilder()
Create a new, empty, OptionsBuilder.
Declaration
public static OptionsBuilder CreateBuilder()
Returns
Type | Description |
---|---|
OptionsBuilder |
CreateBuilder(Options)
Create a new OptionsBuilder that copies its initial values from the given Options.
Declaration
public static OptionsBuilder CreateBuilder(Options options)
Parameters
Type | Name | Description |
---|---|---|
Options | options |
Returns
Type | Description |
---|---|
OptionsBuilder |
Equals(Options)
Returns true if this Options equals the given Options.
Declaration
public bool Equals(Options options)
Parameters
Type | Name | Description |
---|---|---|
Options | options |
Returns
Type | Description |
---|---|
System.Boolean |
Equals(Object)
Returns true if this object equals the given Options.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj |
Returns
Type | Description |
---|---|
System.Boolean |
GetHashCode()
Returns a stable hash for this Options.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
ToString()
Returns a representation of this Options object.
Only for debugging, this value is not guaranteed to be stable.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |
Operators
Equality(Options, Options)
Compare two Options for equality
Declaration
public static bool operator ==(Options a, Options b)
Parameters
Type | Name | Description |
---|---|---|
Options | a | |
Options | b |
Returns
Type | Description |
---|---|
System.Boolean |
Inequality(Options, Options)
Compare two Options for inequality
Declaration
public static bool operator !=(Options a, Options b)
Parameters
Type | Name | Description |
---|---|---|
Options | a | |
Options | b |
Returns
Type | Description |
---|---|
System.Boolean |