CsvReaderTResult(CsvReader, CsvMapping, FuncObject, TResult, Boolean) Constructor

Initializes a new CsvReaderTResult instance.

Definition

Namespace: FolkerKinzel.CsvTools.Mappings
Assembly: FolkerKinzel.CsvTools.Mappings (in FolkerKinzel.CsvTools.Mappings.dll) Version: 1.1.0+1263e8243dc2cd78095f678f813d7d9c52ea4315
C#
public CsvReader(
	CsvReader reader,
	CsvMapping mapping,
	Func<Object, TResult> conversion,
	bool cloneMapping = true
)

Parameters

reader  CsvReader
A CsvReader instance.
mapping  CsvMapping
The CsvMapping used to convert the CSV data.
conversion  FuncObject, TResult

A function that converts the content of mapping to an instance of TResult.

The function is called for each row in the CSV data and gets the specified CsvMapping as argument, filled with the current CsvRecord instance. The CsvMapping is passed to the function as dynamic argument: Inside the function the registered DynamicProperty instances can be used like regular .NET properties, but without IntelliSense ("late binding").

cloneMapping  Boolean  (Optional)
true to clone mapping each time before passing it to conversion, or false to use always the same CsvMapping instance. (Cloning is required if TResult is CsvMapping and the results need to be cached.)

Remarks

  Tip

It's recommended to use the methods of CsvConverter to create an instance.

Exceptions

ArgumentNullExceptionreader, or mapping, or conversion is null.

See Also