Table of Contents

Class CsvTypeMap<T, TValue>

Namespace
FlameCsv.Binding
Assembly
FlameCsv.Core.dll

Provides compile-time mapping to parse TValue records from CSV.

public abstract class CsvTypeMap<T, TValue> : CsvTypeMap where T : unmanaged, IBinaryInteger<T>

Type Parameters

T

Token type

TValue

Record type

Inheritance
CsvTypeMap<T, TValue>
Inherited Members

Remarks

Decorate a non-generic partial class with CsvTypeMapAttribute<T, TValue> to generate the implementation.

Properties

TargetType

Returns the mapped type.

protected override sealed Type TargetType { get; }

Property Value

Type

Methods

BindForReading(CsvOptions<T>)

Returns a materializer for TValue bound to column indexes.

protected virtual IMaterializer<T, TValue> BindForReading(CsvOptions<T> options)

Parameters

options CsvOptions<T>

Returns

IMaterializer<T, TValue>

Remarks

Caches the materializer based on the type and options. This can be overridden per type map.

BindForReading(scoped ReadOnlySpan<string>, CsvOptions<T>)

Returns a materializer for TValue bound to CSV header.

protected virtual IMaterializer<T, TValue> BindForReading(scoped ReadOnlySpan<string> headers, CsvOptions<T> options)

Parameters

headers ReadOnlySpan<string>
options CsvOptions<T>

Returns

IMaterializer<T, TValue>

Remarks

Caches the materializer based on the type, headers, and options. This can be overridden per type map.

BindForWriting(CsvOptions<T>)

Returns a dematerializer for TValue.

protected virtual IDematerializer<T, TValue> BindForWriting(CsvOptions<T> options)

Parameters

options CsvOptions<T>

Returns

IDematerializer<T, TValue>

Remarks

Caches the dematerializer based on the type and options. This can be overridden per type map.

Exceptions

CsvBindingException

Options is configured not to write a header, but TValue has no index binding.

GetDematerializer(CsvOptions<T>)

Returns a dematerializer for TValue.

public IDematerializer<T, TValue> GetDematerializer(CsvOptions<T> options)

Parameters

options CsvOptions<T>

Returns

IDematerializer<T, TValue>

Remarks

Caches the dematerializer based on the type and options. This can be overridden per type map.

Exceptions

CsvBindingException

Options is configured not to write a header, but TValue has no index binding.

GetMaterializer(CsvOptions<T>)

Returns a materializer for TValue bound to column indexes.

public IMaterializer<T, TValue> GetMaterializer(CsvOptions<T> options)

Parameters

options CsvOptions<T>

Returns

IMaterializer<T, TValue>

Remarks

Caches the materializer based on the type and options. This can be overridden per type map.

GetMaterializer(scoped ReadOnlySpan<string>, CsvOptions<T>)

Returns a materializer for TValue bound to CSV header.

public IMaterializer<T, TValue> GetMaterializer(scoped ReadOnlySpan<string> headers, CsvOptions<T> options)

Parameters

headers ReadOnlySpan<string>
options CsvOptions<T>

Returns

IMaterializer<T, TValue>

Remarks

Caches the materializer based on the type, headers, and options. This can be overridden per type map.