CsvMappingBuilderAddPropertyT(String, Int32, TypeConverterT) Method

Adds a new DynamicProperty instance that accesses a single column of the CSV file with its index.

Definition

Namespace: FolkerKinzel.CsvTools.Mappings
Assembly: FolkerKinzel.CsvTools.Mappings (in FolkerKinzel.CsvTools.Mappings.dll) Version: 1.1.0+1263e8243dc2cd78095f678f813d7d9c52ea4315
C#
public CsvMappingBuilder AddProperty<T>(
	string propertyName,
	int csvIndex,
	TypeConverter<T> converter
)

Parameters

propertyName  String
The identifier of the dynamic .NET property. It must follow the rules for C# identifiers. Only ASCII characters are accepted.
csvIndex  Int32
Zero-based index of the column in the CSV file. If this index doesn't exist, the DynamicProperty is ignored when writing. When reading, in this case, DefaultValue is returned.
converter  TypeConverterT
The TypeConverterT that does the type conversion.

Type Parameters

T
The .NET data type of the dynamic property.

Return Value

CsvMappingBuilder
The CsvMappingBuilder to chain calls.

Remarks

Use this method if a CSV file has no header, or, or performance reasons, if the CSV column index is known.

Exceptions

ArgumentNullExceptionpropertyName or converter is null.
ArgumentOutOfRangeExceptioncsvIndex is less than Zero.
ArgumentException

propertyName does not conform to the rules for C# identifiers (only ASCII characters)

- or -

a DynamicProperty with the same PropertyName has already been added.

RegexMatchTimeoutException Validating of propertyName takes too long.

See Also