Table of Contents

Class CsvConverter<T, TValue>

Namespace
FlameCsv
Assembly
FlameCsv.Core.dll

Parses and formats TValue to/from CSV fields.

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

Type Parameters

T

Token type

TValue

Parsed/formatted value

Inheritance
CsvConverter<T, TValue>

Properties

CanFormatNull

Whether the converter formats null values. When false (the default), GetNullToken(Type) is used to write nulls.

protected virtual bool CanFormatNull { get; }

Property Value

bool

Methods

CanConvert(Type)

Returns whether the type can be handled by this converter.

public override bool CanConvert(Type type)

Parameters

type Type

Type to check

Returns

bool

true if the converter is suitable for type

TryFormat(Span<T>, TValue, out int)

Attempts to format value into the field.

public abstract bool TryFormat(Span<T> destination, TValue value, out int charsWritten)

Parameters

destination Span<T>

Buffer to format the value to

value TValue

Value to format

charsWritten int

If successful, how many characters were written to destination

Returns

bool

true if the value was successfully formatted.

TryParse(ReadOnlySpan<T>, out TValue)

Attempts to parse value from the field.

public abstract bool TryParse(ReadOnlySpan<T> source, out TValue value)

Parameters

source ReadOnlySpan<T>

CSV field

value TValue

Parsed value

Returns

bool

true if the value was successfully parsed.