I\'m trying to parse this type of CSV file with FileHelpers:
Tom,1,2,3,4,5,6,7,8,9,10
Steve,1,2,3
Bob,1,2,3,4,5,6
Cthulhu,1,2,3,4,5
Greg,1,2,3,4,5,6,7,8,9,10
You could create a class MyRecord that holds all the potential values, e.g.
[DelimitedRecord(",")]
public class MyRecord
{
public string Name;
public int Value1;
.....
[FieldOptional]
public int Value5;
......
[FieldOptional]
[FieldNullValue(typeof(int), "-1" )]
public int Value14;
}
and make most of those fields optional (no. 5 through 14 in my example) and combine that with e.g. a FieldNullValue to handle those non-existing fields (or make those optional fields a nullable int:
public int? Value5