CsvAsString Method

Converts the contents of data to a comma-separated values String (CSV, RFC 4180).

Definition

Namespace: FolkerKinzel.CsvTools
Assembly: FolkerKinzel.CsvTools (in FolkerKinzel.CsvTools.dll) Version: 2.0.1+2345335399184346d9b2cc992ed5c814406052c1
C#
public static string AsString(
	IEnumerable<IEnumerable<Object?>?> data,
	char delimiter = ',',
	IFormatProvider? formatProvider = null,
	string? format = null
)

Parameters

data  IEnumerableIEnumerableObject
The data to convert.
delimiter  Char  (Optional)
The field separator character.
formatProvider  IFormatProvider  (Optional)

The provider to use to format the value.

- or -

A null reference for InvariantCulture.

format  String  (Optional)

A format String to use for all items that implement IFormattable.

- or -

A null reference to use the default format for each item.

Return Value

String
A CSV-String containing the contents of data.

Remarks

For serialization ToString(String, IFormatProvider) is used if the item implements IFormattable, otherwise ToString.

Exceptions

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

See Also