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
Context
Gets the writing context.
CsvContext Context { get; }
Property Value
HeaderRecord
The header record.
string?[]? HeaderRecord { get; }
Property Value
- string[]
Index
The current field index.
int Index { get; }
Property Value
Row
The current row.
int Row { get; }
Property Value
Methods
WriteComment(string?)
Writes a comment.
void WriteComment(string? comment)
Parameters
commentstringThe 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
fieldstringThe converted field to write.
fieldTypeTypeThe 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
fieldstringThe 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
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
fieldTThe field to write.
Type Parameters
TThe 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
fieldTThe field to write.
converterITypeConverterThe converter used to convert the field into a string.
Type Parameters
TThe 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
fieldTThe field to write.
Type Parameters
TThe type of the field.
TConverterThe type of the converter.
WriteHeader(Type)
Writes the header record from the given members.
void WriteHeader(Type type)
Parameters
typeTypeThe type of the record.
WriteHeader<T>()
Writes the header record from the given members.
void WriteHeader<T>()
Type Parameters
TThe type of the record.
WriteRecord<T>(T)
Writes the record to the CSV file.
void WriteRecord<T>(T record)
Parameters
recordTThe record to write.
Type Parameters
TThe type of the record.