Table of Contents

Class CsvFileWriter

Namespace
Ecng.Common
Assembly
Ecng.Common.dll

Class for writing to comma-separated-value (CSV) files.

public class CsvFileWriter : CsvFileCommon, IDisposable
Inheritance
CsvFileWriter
Implements
Inherited Members
Extension Methods

Constructors

CsvFileWriter(Stream, Encoding)

Initializes a new instance of the CsvFileWriter class for the specified stream.

public CsvFileWriter(Stream stream, Encoding encoding = null)

Parameters

stream Stream

The stream to write to

encoding Encoding

The text encoding.

CsvFileWriter(string)

Initializes a new instance of the CsvFileWriter class for the specified file path.

public CsvFileWriter(string path)

Parameters

path string

The name of the CSV file to write to

Methods

DisposeManaged()

Disposes the managed resources. Override this method to add custom clean up of managed resources.

protected override void DisposeManaged()

Encode(string)

Encodes a column's value for output.

public string Encode(string column)

Parameters

column string

Returns

string

WriteRow(IEnumerable<string>)

Writes a row of columns to the current CSV file.

public void WriteRow(IEnumerable<string> columns)

Parameters

columns IEnumerable<string>

The list of columns to write