The FileHelpers class is just a way to define a flat file specification using the restricted C # syntax as the definition language. Thus, FileHelpers classes are an unusual type of C # class, and you should not try to use them in any other way. Imagine that the FileHelpers class is a โspecificationโ of your CSV format. This should be his only role. If you need entries in a more โnormalโ object (in your case, you need properties instead of fields), then compare the results with something like this:
FileHelperEngine engine = new FileHelperEngine<FileHelpersOrder>(); var records = engine.ReadFile("FileIn.txt"); var niceOrders = records.Select( x => new NiceOrder() { Number = x.Number, Customer = x.Customer
Where FileHelpersOrder is your CSV specification and NiceOrder will be a suitable OOP class with properties, methods, etc. as needed.
If you export, you need to do the opposite, i.e. Select the FileHelpersOrder collection from the NiceOrder collection.
source share