CsvConverterOpenReadTResult(TextReader, CsvToTResult, Char, Boolean, CsvOpts) Method

Initializes a CsvReaderTResult instance to parse CSV data as a collection of TResult instances.

Definition

Namespace: FolkerKinzel.CsvTools.Mappings
Assembly: FolkerKinzel.CsvTools.Mappings (in FolkerKinzel.CsvTools.Mappings.dll) Version: 1.1.0+1263e8243dc2cd78095f678f813d7d9c52ea4315
C#
public static CsvReader<TResult> OpenRead<TResult>(
	TextReader reader,
	CsvTo<TResult> converter,
	char delimiter = ',',
	bool isHeaderPresent = true,
	CsvOpts options = CsvOpts.Default
)

Parameters

reader  TextReader
The TextReader with which the CSV data is read.
converter  CsvToTResult
An object that converts a CSV row to a TResult instance.
delimiter  Char  (Optional)
The field separator character.
isHeaderPresent  Boolean  (Optional)
true, to interpret the first line as a header, otherwise false.
options  CsvOpts  (Optional)
Options for reading CSV.

Type Parameters

TResult
Generic type parameter that specifies the Type of the items that the CsvReaderTResult returns.

Return Value

CsvReaderTResult
A CsvReaderTResult that allows you to iterate through the data parsed from the CSV.

Remarks

When importing CSV data from Excel, the appropriate arguments can be determined with GetExcelArguments.

Exceptions

ArgumentNullExceptionreader, or converter is null.
ArgumentOutOfRangeExceptiondelimiter is either the double quotes " or a line break character ('\r' or '\n').

See Also