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
TToken type
TValueParsed/formatted value
- Inheritance
-
objectCsvConverter<T>CsvConverter<T, TValue>
- Derived
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
Methods
CanConvert(Type)
Returns whether the type can be handled by this converter.
public override bool CanConvert(Type type)
Parameters
typeTypeType to check
Returns
- bool
trueif the converter is suitable fortype
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
destinationSpan<T>Buffer to format the value to
valueTValueValue to format
charsWrittenintIf successful, how many characters were written to
destination
Returns
- bool
trueif 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
sourceReadOnlySpan<T>CSV field
valueTValueParsed value
Returns
- bool
trueif the value was successfully parsed.