I've been using Josh Close' CsvHelper a bit recently to parse CSV files, I quite like the fluent api for class mapping.
I'm trying to map a csv file which contains multiple record types, the file structure is
C,Comment,Timestamp
I,Class1,Header1,Header2
D,Class1,Data1,Data2
D,Class1,Data1,Data2
...
I,Class2,Header1,Header2,Header3
D,Class2,Data1,Data2,Data3
D,Class2,Data1,Data2,Data3
...
C,Checksum
Is this something which can be handled by CsvHelper? I've writen a custom parser which basically works but all it really does is filter out the Header and Data fields for a specific class - I'd really like to be able to do something like
csv.Configuration.RegisterClassMap<Class1>();
csv.Configuration.RegisterClassMap<Class2>();
var data1 = csv.GetRecords<Class1>().ToList();
var data2 = csv.GetRecords<Class2>().ToList();
And read the file in one pass? Is this possible or am I using the wrong parser?
Regards Dave