.NET Library For Fixed Length Text Files

烂漫一生 提交于 2019-12-18 12:32:16

问题


I'm looking for a .NET (much preferably open source in C#) library for dealing with fixed length field text files. It wouldn't be too much to write one, but existing, tested work is always nicer, to start with.

I will be extracting data in fixed length fields from files produced by a PBX. Each PBX has its own file format, as well a set of record formats. I'm looking for a library with a nice a simple way of using dynamic file and record formats, e.g. read from an INI or XML file.

EDIT: I had previously overlooked Marcos Meli' great library FileHelpers, because I thought I needed to create a class for each record type at compile time. This is not so, and the lib includes a ClassBuilder class to build classes at runtime.

NEW EDIT: Records from different PBX's differ only in layout, not in data, i.e. all the record layouts map to the same class. I'm wondering if I should use FileHelper attributes that dynamically read their start and length data from a config file?


回答1:


I have since been pointed to this XML based parsing code, as well as this similar project on CodeProject. The more the merrier, and the closer I will get to a 'perfect' fit.



来源:https://stackoverflow.com/questions/1444165/net-library-for-fixed-length-text-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!