Struct CsvIOOptions
Represents options for configuring ICsvBufferReader<T> and ICsvBufferWriter<T>.
public readonly record struct CsvIOOptions : IEquatable<CsvIOOptions>
- Implements
Fields
DefaultBufferSize
The default buffer size (16 KiB).
public const int DefaultBufferSize = 16384
Field Value
- See Also
DefaultFileBufferSize
The default buffer size when doing file I/O (64 KiB).
This is used when the buffer size is not set by the user when using
the file I/O methods of CsvWriter and CsvReader.
public const int DefaultFileBufferSize = 65536
Field Value
- See Also
DefaultMinimumReadSize
The default minimum read size (1 KiB).
This is used when the minimum read size is not set by the user.
public const int DefaultMinimumReadSize = 1024
Field Value
- See Also
MinimumBufferSize
The minimum buffer size, values below this will be clamped.
public const int MinimumBufferSize = 256
Field Value
Properties
BufferSize
Gets or sets the buffer size. If set to -1, the default buffer size is used.
This value will be clamped to be at minimum MinimumBufferSize.
public int BufferSize { get; init; }
Property Value
Remarks
This is only the initial value; the buffer may be resized during reading if needed.
If unset, either DefaultBufferSize or DefaultFileBufferSize will be used
depending on the context.
Exceptions
- ArgumentOutOfRangeException
Thrown if the value is negative or zero and not -1.
- See Also
LeaveOpen
Gets or sets a value indicating whether the inner stream/reader should be left open after use.
The default is false
.
public bool LeaveOpen { get; init; }
Property Value
Remarks
This parameter is not used if the data source or destination is not user provided, e.g. a file stream created in WriteToFile<TValue>(string, IEnumerable<TValue>, CsvOptions<byte>?, CsvIOOptions)
MinimumReadSize
Gets or sets the minimum available data size when reading. If unset or set to -1, the smaller of DefaultMinimumReadSize and BufferSize / 2 will be used.
public int MinimumReadSize { get; init; }
Property Value
Remarks
This threshold determines when more data should be read from the source. If less than the minimum size of data is available, and more data is available from the source, more data will be read.
Exceptions
- ArgumentOutOfRangeException
Thrown if the value is negative or zero and not -1.
- See Also
NoDirectBufferAccess
Disable direct buffer reading optimization when reading MemoryStream or
StringReader with an exposable buffer.
The default is false
.
public bool NoDirectBufferAccess { get; init; }
Property Value
Remarks
An internal optimization reads directly from the internal buffer from a set of known types.
If this behavior is undesired, set this to true
.