I've a data file(csv) which I need to read in c#, but different libraries
- CsvHelper
- LumenWorksCsvReader
are fail to accomplish this.
Ex. with LumenWorksCsvReader
using (CsvReader csv = new CsvReader(new StreamReader(path), true))
{
int fieldCount = csv.FieldCount;
string[] headers = csv.GetFieldHeaders();
while (csv.ReadNextRecord())
{
for (int i = 0; i < fieldCount; i++)
Console.Write(string.Format("{0} = {1};",
headers[i], csv[i]));
Console.WriteLine();
}
}
Above code broke at reading the Deivce cell in 2nd row.
My data is look a like
InvoiceDate,Device
2022/07/16,"i5-10210U 1,6GHz 2x8GB W10P64;14\" 256GB SSD, Einbau"
as you can see the data is perfect, but while reading in c#, everything got failed to accommodate this type of data situation