DelimitedDocument Class
Definition
Provides a read-only, forward-parsed view over a delimited (CSV/TSV) document, shaped after System.Text.Json's
JsonDocument. The document is an array of records.
public sealed class DelimitedDocument : IDisposable
- Inheritance
-
DelimitedDocument
- Implements
- Inherited Members
- Extension Methods
Remarks
The document owns a flat store of decoded rows and must be disposed when no longer needed; every DelimitedElement obtained from it becomes invalid once the document is disposed.
Properties
Headers
Gets the header column names, or an empty list in headerless mode.
public IReadOnlyList<string> Headers { get; }
Property Value
- IReadOnlyList<string>
The header names.
RootElement
Gets the root element, which is always the document array of records.
public DelimitedElement RootElement { get; }
Property Value
- DelimitedElement
The root DelimitedElement.
Exceptions
- ObjectDisposedException
Thrown when the document has been disposed.
Methods
Dispose()
Releases the document's backing store.
public void Dispose()
Parse(ReadOnlySpan<byte>)
Parses the supplied UTF-8 bytes into a read-only delimited document.
public static DelimitedDocument Parse(ReadOnlySpan<byte> utf8Delimited)
Parameters
utf8DelimitedReadOnlySpan<byte>The delimited source bytes.
Returns
- DelimitedDocument
The parsed document.
Exceptions
- DelimitedFormatException
Thrown when the bytes are not valid delimited text.
Parse(ReadOnlySpan<byte>, DelimitedReaderOptions)
Parses the supplied UTF-8 bytes into a read-only delimited document using the supplied reader options.
public static DelimitedDocument Parse(ReadOnlySpan<byte> utf8Delimited, DelimitedReaderOptions options)
Parameters
utf8DelimitedReadOnlySpan<byte>The delimited source bytes.
optionsDelimitedReaderOptionsThe reader options.
Returns
- DelimitedDocument
The parsed document.
Exceptions
- DelimitedFormatException
Thrown when the bytes are not valid delimited text.
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |