I am parsing BgMax file (normal text file separated by rows each property has a specific length in row) with Filehelpers library and I have succesfully created objects and records with FixedLengthRecord. However I would like to store the whole line for each record as a string not only the properties as objects. Is there a neat way like adding a FieldHidden property or something to the Record class so that it saves the whole line there automatically? I also thought to save that line when I am done with creating the Record object but I think it is a bit complicated / not a good idea to do this as I think I need to access the property through reflection.
As an example here is one of the record classes that I use
[FixedLengthRecord(FixedMode.AllowMoreChars)]
public class StartRecord
{
[FieldFixedLength(2)]
public string PostType;
[FieldFixedLength(20)]
public string LayoutName;
...
[FieldFixedLength(1)]
public string TestMarker;
}
On this StartRecord class I would like to have another string property named Source that will include the whole line before converted into object. The object is being populated from this code and it is pretty easy to get that line since it the record comes from a foreach loop of list of records.
switch (record.Substring(0, 2))
{
case "01":
return typeof (StartRecord);
}
So I could maybe populate the property here but I do not like it that much.