CsvConverterParseTResult(String, CsvToTResult, Char, Boolean, CsvOpts) Method

Parses a CSV-String.

Definition

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

Parameters

csv  String
The CSV-String to parse.
converter  CsvToTResult
An object that converts a CSV row to a TResult instance.
delimiter  Char  (Optional)
The field separator character used in csv.
isHeaderPresent  Boolean  (Optional)
true, to interpret the first line as a header, otherwise false.
options  CsvOpts  (Optional)
Parsing options.

Type Parameters

TResult
Generic type parameter that specifies the Type of the items in the array that the method returns.

Return Value

TResult
An array of TResult instances, initialized from the parsed csv.

Remarks

Exceptions

ArgumentNullExceptioncsv or converter is null.
CsvFormatExceptionInvalid CSV. The interpretation depends on options.
FormatException Parsing fails and Throwing is true.

See Also