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, IEquatable<CsvTypeMap<T, TValue>> where T : unmanaged, IBinaryInteger<T>

Type Parameters

T

Token type

TValue

Record type

Inheritance
object
CsvTypeMap<T, TValue>
Implements
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 field 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(ImmutableArray<string>, CsvOptions<T>)

Returns a materializer for TValue bound to CSV header.

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

Parameters

headers ImmutableArray<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.

Equals(CsvTypeMap<T, TValue>?)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(CsvTypeMap<T, TValue>? other)

Parameters

other CsvTypeMap<T, TValue>

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Determines whether the specified object is equal to the current object.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

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.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

GetMaterializer(CsvOptions<T>)

Returns a materializer for TValue bound to field 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(ImmutableArray<string>, CsvOptions<T>)

Returns a materializer for TValue bound to CSV header.

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

Parameters

headers ImmutableArray<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.