CsvWriter Class

Writes string data as CSV (RFC 4180).

Definition

Namespace: FolkerKinzel.CsvTools
Assembly: FolkerKinzel.CsvTools (in FolkerKinzel.CsvTools.dll) Version: 2.0.1+2345335399184346d9b2cc992ed5c814406052c1
C#
public sealed class CsvWriter : IDisposable
Inheritance
Object    CsvWriter
Implements
IDisposable

Remarks

CsvWriter provides a CsvRecord object in its Record property that represents a buffer for a data record (row) of the CSV file. Fill the CsvRecord object with data and then write it to the file using the WriteRecord method! After the WriteRecord returns all fields of Record are reset to Empty so that the CsvRecord object can be filled again.

Constructors

CsvWriter(TextWriter, Int32, Char)Initializes a new CsvWriter object to write CSV data without a header row.
CsvWriter(String, Int32, Char, Encoding)Initializes a new CsvWriter object to write a CSV file without a header row.
CsvWriter(TextWriter, IEnumerableString, Boolean, Char)Initializes a new CsvWriter object with the column names for the header row to be written.
CsvWriter(String, IEnumerableString, Boolean, Char, Encoding)Initializes a new CsvWriter object with the column names for the header row to be written.

Properties

Delimiter Gets the field separator character.
RecordGets the record to be written to the file.

Methods

DisposeReleases the resources. (Closes the CSV file.)
EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetTypeGets the Type of the current instance.
(Inherited from Object)
ToStringReturns a string that represents the current object.
(Inherited from Object)
WriteRecord Writes the contents of Record to the CSV file and then sets all fields of Record to Empty. (The first time it is called, the header row may also be written.)

See Also