Class CsvConverterAttribute<TConverter>
- Namespace
- FlameCsv.Attributes
- Assembly
- FlameCsv.Core.dll
Overrides the converter for the target member or parameter.
TConverter must have a parameterless constructor,
or a public constructor with a single CsvOptions<T> parameter.
public sealed class CsvConverterAttribute<TConverter> : CsvConverterAttribute where TConverter : class
Type Parameters
TConverterConverter or factory type
- Inheritance
-
objectCsvConverterAttribute<TConverter>
- Inherited Members
Remarks
Converters created this way are distinct from the cached converters in CsvOptions<T>, and are
cached per member or parameter it is applied to.
The resulting converter is cast to CsvConverter<T, TValue>.
Methods
TryCreateConverterOrFactory<T>(Type, CsvOptions<T>, out CsvConverter<T>?)
Attempts to create a converter for the target member or parameter.
If the configured converter is not for token type T, this method should return false.
If the converter is not for the target type, this method should throw a CsvConfigurationException.
protected override bool TryCreateConverterOrFactory<T>(Type targetType, CsvOptions<T> options, out CsvConverter<T>? converter) where T : unmanaged, IBinaryInteger<T>
Parameters
targetTypeTypeType to convert
optionsCsvOptions<T>Current configuration instance
converterCsvConverter<T>Created converter
Returns
- bool
Converter instance
Type Parameters
T
Exceptions
- CsvConfigurationException
Thrown if
targetTypeis not valid for the member, or is not present in the configuration and has no parameterless constructor.