public interface ICsvConverter<T>
Namespace
CsvHelper
Assembly
CsvHelper.dll
Builds
net10.0 netstandard2.1 netstandard2.0 net47

Remarks

A converter needs a public or internal parameterless constructor. Each mapper and record writer creates one instance and calls it for every record; the workers of CsvReader.ParallelEnumerate<T>(int) share a mapper, so a converter must be thread-safe (one without fields is).

Methods

Read(CsvReader, int)

Added in v34.0.0
T Read(CsvReader reader, int index)

Reads the value of field index of the current record.

Parameters

readerCsvReader
The reader, positioned on the record.
indexint
The 0-based index of the member's column.

Returns

T
The value of the member.

View source

Write(CsvWriter, T)

Added in v34.0.0
void Write(CsvWriter writer, T value)

Writes the value of the member as one field of the current record, with one of the writer's WriteField methods, in a form that Read reads back.

Parameters

writerCsvWriter
The writer, in the middle of the record.
valueT
The value of the member.

View source