Table of Contents

IDelimitedRecordFactory<TRecord> Interface

Definition

Namespace
Bodu.Text.Delimited
Assembly
Bodu.Text.Delimited.dll
Package
Bodu.Text.Delimited 1.0.0
Source
IDelimitedRecordFactory{T}.cs

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

public interface IDelimitedRecordFactory<TRecord>

Type Parameters

TRecord

The record type.

Extension Methods

Remarks

Implementations are typically emitted at compile time by the Bodu.Text.Formats.Generators source generator for types annotated with DelimitedRecordAttribute, but the interface can equally be implemented by hand when full control over the field mapping is required. Because no member of this contract inspects types at runtime, the factory-based serializer paths are safe for trimming and ahead-of-time compilation.

Properties

Headers

Gets the column names of the record type, in field order.

IReadOnlyList<string> Headers { get; }

Property Value

IReadOnlyList<string>

The resolved column names.

Methods

Create(string[], IReadOnlyList<string>)

Creates a record instance from decoded field values.

TRecord Create(string[] fields, IReadOnlyList<string> headers)

Parameters

fields string[]

The decoded field values of one record.

headers IReadOnlyList<string>

The document's header columns, used to map fields by name; empty for a headerless document, in which case fields bind positionally in Headers order.

Returns

TRecord

The created record.

GetFields(TRecord)

Converts a record instance to its delimited field values, in Headers order.

string[] GetFields(TRecord record)

Parameters

record TRecord

The record instance.

Returns

string[]

The field values.

Applies to

ProductVersions
.NET8, 10