CsvWriter(String, Int32, Char, Encoding) Constructor

Initializes a new CsvWriter object to write a CSV file without a header row.

Definition

Namespace: FolkerKinzel.CsvTools
Assembly: FolkerKinzel.CsvTools (in FolkerKinzel.CsvTools.dll) Version: 2.0.1+2345335399184346d9b2cc992ed5c814406052c1
C#
public CsvWriter(
	string filePath,
	int columnsCount,
	char delimiter = ',',
	Encoding? textEncoding = null
)

Parameters

filePath  String
File path of the CSV file.
columnsCount  Int32
Number of columns in the CSV file.
delimiter  Char  (Optional)
The field separator character.
textEncoding  Encoding  (Optional)
The Encoding to be used or null for UTF8.

Remarks

The constructor creates a new file at the specified filePath. If the file already exists, it is truncated and overwritten.

Exceptions

ArgumentNullExceptionfilePath is null.
ArgumentExceptionfilePath is not a valid file path.
ArgumentOutOfRangeException

columnsCount is negative

- or -

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

IOExceptionI/O error.

See Also