DelimitedWriterOptions Struct
Definition
- Assembly
- Bodu.Text.Delimited.dll
- Package
- Bodu.Text.Delimited 1.3.0
Provides configuration for a Utf8DelimitedWriter, controlling the delimiter, quote character, the comment character the writer guards, and whether a header row is emitted for object records.
public readonly struct DelimitedWriterOptions
- Inherited Members
- Extension Methods
Remarks
The options are an immutable value type. When left unset, the delimiter, quote, and comment characters fall back to
their defaults: ',', '"', and '#'.
The writer emits the delimiter and quote as single bytes of its UTF-8 output and compares the comment character with single characters, so each must be an ASCII character other than a carriage return or a line feed, and no two of them may be the same character. The Utf8DelimitedWriter constructors throw ArgumentException for options that break these rules.
Properties
CommentChar
Gets the comment character a reader of the output may use, or '\0' to use the default '#'.
public char CommentChar { get; init; }
Property Value
- char
The comment character.
Remarks
The writer never writes comments. It quotes a record's first field when the field begins with this character, so that a reader that allows comments with the same character reads the record rather than skipping it as a comment line. Quoting such a field is harmless for a reader that does not allow comments, so the writer guards the character whether or not the eventual reader allows them.
The comment character must be an ASCII character other than a carriage return or a line feed, and must differ from Delimiter and Quote.
Default
Gets the default writer options (comma delimiter, double-quote quoting, header row emitted).
public static DelimitedWriterOptions Default { get; }
Property Value
- DelimitedWriterOptions
The default options.
Delimiter
Gets the field delimiter, or '\0' to use the default comma.
public char Delimiter { get; init; }
Property Value
- char
The delimiter character.
Remarks
The delimiter must be an ASCII character other than a carriage return or a line feed, and must differ from Quote and CommentChar.
NoHeader
Gets a value indicating whether the header row is suppressed for object records.
public bool NoHeader { get; init; }
Property Value
Quote
Gets the quote character, or '\0' to use the default double quote.
public char Quote { get; init; }
Property Value
- char
The quote character.
Remarks
The quote must be an ASCII character other than a carriage return or a line feed, and must differ from Delimiter and CommentChar.
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |