Table of Contents

Bodu.Text.Delimited Namespace

Package

Bodu.Text.Delimited

Purpose

Bodu.Text.Delimited parses and emits delimited records - CSV, TSV, and other character-separated value documents - as a standalone System.Text.Json-shaped library: a typed record serializer, a forward-only UTF-8 token reader/writer pair, a mutable node DOM, and a read-only document DOM. It ships as its own package (also available through the Bodu.Text.Formats umbrella); see also Bodu.Text.DotEnv, Bodu.Text.Ini, Bodu.Text.Bencode, and Bodu.Text.Toml.

Key types

Example

using Bodu.Text.Delimited;
using Bodu.Text.Serialization;

var options = new DelimitedSerializerOptions { PropertyNamingPolicy = NamingPolicy.SnakeCaseLower };
List<Trade> trades = DelimitedSerializer.Deserialize<Trade>("trade_id,symbol\n1,AAPL\n", options);
string csv = DelimitedSerializer.Serialize(trades, options);

Notes

  • Streaming preferred for large inputs. Use DeserializeAsyncEnumerableAsync<TRecord> for typed rows, or the Utf8DelimitedReader token loop for full control.
  • Round-trip determinism. Writing quotes only the fields that require it under the configured delimiter/quote characters.
  • See also: the line-formats introduction and the delimited guide.

Namespaces

Bodu.Text.Delimited.Document
Bodu.Text.Delimited.Nodes
Bodu.Text.Delimited.Reader
Bodu.Text.Delimited.Writer

Classes

DelimitedFormatException

Represents an error that occurs when delimited (CSV/TSV) data is malformed, such as an unterminated quoted field or a record whose field count violates the configured policy.

DelimitedRecordAttribute

Marks a partial record POCO for compile-time delimited binding: the Bodu.Text.Formats.Generators source generator emits an IDelimitedRecordFactory<TRecord> implementation for the type, exposed through a generated static DelimitedFactory property.

DelimitedSerializationException

Represents an error that occurs while mapping .NET records to or from delimited text with DelimitedSerializer, such as a non-collection root or a value that cannot be converted to the target column type.

DelimitedSerializer

Provides methods for serializing collections of .NET records to delimited (RFC 4180 CSV/TSV) text and deserializing delimited text into records, shaped after System.Text.Json's JsonSerializer.

DelimitedSerializerOptions

Provides configuration for DelimitedSerializer, controlling column naming, case sensitivity, field inclusion, and the output delimiter, quote, and header behaviour.

Interfaces

IDelimitedRecordFactory<TRecord>

Provides reflection-free conversion between a record type and its delimited field representation, consumed by the DelimitedSerializer factory overloads.

Enums

DelimitedDuplicateHeaderBehavior

Specifies how a delimited reader resolves a header row that contains the same column name more than once.

DelimitedFieldCountBehavior

Specifies how a delimited reader treats a data record whose field count differs from the header's.

DelimitedMalformedRecordBehavior

Specifies how a delimited reader responds to a record that violates the configured field-count policy.

DelimitedSerializerDefaults

Specifies a set of default settings a DelimitedSerializerOptions can be initialized from.

DelimitedTokenType

Enumerates the token kinds a Utf8DelimitedReader reports as it advances through a delimited (CSV/TSV) document.

DelimitedValueKind

Enumerates the value kinds a delimited node or element can represent.