IDelimitedRecordFactory<TRecord> Interface
Definition
- Assembly
- Bodu.Text.Delimited.dll
- Package
- Bodu.Text.Delimited 1.0.0
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
TRecordThe 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
fieldsstring[]The decoded field values of one record.
headersIReadOnlyList<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
recordTRecordThe record instance.
Returns
- string[]
The field values.
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |