I couldn't get anything to pass all my tests for CSV Parsing, so I ended up writing something simple to do it. AnotherCsvParser
It does everything I need... but should be easy to fork and extend to your needs too.
Given:
public class ABCD
{
public string A;
public string B;
public string C;
public string D;
}
It assumes the columns are in the order the fields are defined..(but would be easy to extend to read an attribute or something)
This works:
var output = NigelThorne.CSVParser.ReadCSVAs<ABCD>(
"a,\"b\",c,d\n1,2,3,4\n\"something, with a comma\",\"something \\\"in\\\" quotes\",\" a \\\\ slash \",\n,,\"\n\",");
Such that:
Assert.AreEqual(4, output.ToArray().Length);
var row1 = output.ToArray()[0];
Assert.AreEqual("a", row1.A);
Assert.AreEqual("b", row1.B);
Assert.AreEqual("c", row1.C);
Assert.AreEqual("d", row1.D);
Note: It's probably not very fast with lots of data either.. again not a problem for me.