CsvConverterToCsvTSource(IEnumerableTSource, Int32, CsvFromTSource, Char) Method

Converts a collection of TSource instances to a CSV String without header row.

Definition

Namespace: FolkerKinzel.CsvTools.Mappings
Assembly: FolkerKinzel.CsvTools.Mappings (in FolkerKinzel.CsvTools.Mappings.dll) Version: 1.1.0+1263e8243dc2cd78095f678f813d7d9c52ea4315
C#
public static string ToCsv<TSource>(
	IEnumerable<TSource> data,
	int columnsCount,
	CsvFrom<TSource> converter,
	char delimiter = ','
)

Parameters

data  IEnumerableTSource
The data to convert to CSV. Each item will be represented with a CSV row.
columnsCount  Int32
Number of columns in the CSV file.
converter  CsvFromTSource
An object that converts a TSource instance to a CSV row.
delimiter  Char  (Optional)
The field separator character.

Type Parameters

TSource
Generic type parameter for the data type to write as CSV row.

Return Value

String
A CSV String without header row that contains the contents of data.

Exceptions

ArgumentNullExceptiondata or converter is null.
ArgumentOutOfRangeExceptioncolumnsCount is negative.
IOExceptionI/O error.

See Also