FixedWidthParserWriter icon indicating copy to clipboard operation
FixedWidthParserWriter copied to clipboard

Add Call for Single Line Parse

Open dandoucette opened this issue 5 years ago • 0 comments

I found your code via Reddit and it appears to work for what I want. My problem is the file I'm working on tries to stuff relational data into a text file. One line is the header, next line is a transaction, next line is a child of transaction and so on. When I read in the lines I have to parse one line at a time going into a different object. Now it's not a big deal to add my line to a list and parse the list and return the first item from the return list but just feels like a hack.

It would be too hard to add a parse single line, not sure if it would go in the same class or a different one called FixedWidthLineProvider<T>

It could just have a call like: public T Parse(string line, int structureTypeId) { return ParseData<T>(new List { line }, FieldType.LineField)); }

Or something like that, maybe the base call ParseData could even be changed to handle one line rather than a list as well.

dandoucette avatar Jun 29 '20 18:06 dandoucette