Fast C# CSV parser
Ultra-fast C# CSV parser: implements stream reader and writer.
Parse CSV stream:
using (var streamRdr = new StreamReader(inputStream)) {
var csvReader = new CsvReader(streamRdr, ",");
while (csvReader.Read()) {
for (int i=0; i<csvReader.FieldsCount; i++) {
string val = csvReader[i];
}
}
}
Generate CSV to stream:
using (var streamWr = new StreamWrite(outputStream)) {
var csvWriter = new CsvWriter(streamWr);
// write line
csvWriter.WriteField("Value with double quote\"");
csvWriter.WriteField("And with\nnew line");
csvWriter.WriteField("Normal");
csvWriter.NextRecord();
}
NReco.Csv is in production use at SeekTable.com and PivotData microservice.
Copyright 2017-2023 Vitaliy Fedorchenko and contributors
Distributed under the MIT license