Table of Contents

Interface IWriterRow

Namespace
CsvHelper
Assembly
CsvHelper.dll

Defines methods used to write a CSV row.

public interface IWriterRow

Properties

Configuration

Gets or sets the configuration.

IWriterConfiguration Configuration { get; }

Property Value

IWriterConfiguration

Context

Gets the writing context.

CsvContext Context { get; }

Property Value

CsvContext

HeaderRecord

The header record.

string?[]? HeaderRecord { get; }

Property Value

string[]

Index

The current field index.

int Index { get; }

Property Value

int

Row

The current row.

int Row { get; }

Property Value

int

Methods

WriteComment(string?)

Writes a comment.

void WriteComment(string? comment)

Parameters

comment string

The comment to write.

WriteConvertedField(string?, Type)

Writes a field that has already been converted to a string from an ITypeConverter. If the field is null, it won't get written. A type converter will always return a string, even if field is null. If the converter returns a null, it means that the converter has already written data, and the returned value should not be written.

void WriteConvertedField(string? field, Type fieldType)

Parameters

field string

The converted field to write.

fieldType Type

The type of the field before it was converted into a string.

WriteField(string?)

Writes the field to the CSV file. The field may get quotes added to it. When all fields are written for a record, NextRecord() must be called to complete writing of the current record.

void WriteField(string? field)

Parameters

field string

The field to write.

WriteField(string?, bool)

Writes the field to the CSV file. This will ignore any need to quote and ignore ShouldQuote and just quote based on the shouldQuote parameter. When all fields are written for a record, NextRecord() must be called to complete writing of the current record.

void WriteField(string? field, bool shouldQuote)

Parameters

field string

The field to write.

shouldQuote bool

True to quote the field, otherwise false.

WriteField<T>(T?)

Writes the field to the CSV file. When all fields are written for a record, NextRecord() must be called to complete writing of the current record.

void WriteField<T>(T? field)

Parameters

field T

The field to write.

Type Parameters

T

The type of the field.

WriteField<T>(T?, ITypeConverter)

Writes the field to the CSV file. When all fields are written for a record, NextRecord() must be called to complete writing of the current record.

void WriteField<T>(T? field, ITypeConverter converter)

Parameters

field T

The field to write.

converter ITypeConverter

The converter used to convert the field into a string.

Type Parameters

T

The type of the field.

WriteField<T, TConverter>(T?)

Writes the field to the CSV file using the given ITypeConverter. When all fields are written for a record, NextRecord() must be called to complete writing of the current record.

void WriteField<T, TConverter>(T? field)

Parameters

field T

The field to write.

Type Parameters

T

The type of the field.

TConverter

The type of the converter.

WriteHeader(Type)

Writes the header record from the given members.

void WriteHeader(Type type)

Parameters

type Type

The type of the record.

WriteHeader<T>()

Writes the header record from the given members.

void WriteHeader<T>()

Type Parameters

T

The type of the record.

WriteRecord<T>(T)

Writes the record to the CSV file.

void WriteRecord<T>(T record)

Parameters

record T

The record to write.

Type Parameters

T

The type of the record.