Search code examples
c#fileflat

Fix length record and creating a file


I have to create a fix length record file using C#. I read the records from database and then after some business logic I would like to write some of the fields into a text file. I researched this and some recommend using an XML to define the file, while others format the string and then write that into a file.

Is there a proper way to do this? I would like to keep this object oriented.

Thanks for any hints.


Solution

  • take a look at http://www.filehelpers.com/ to export the data to a fixed file format. you may also want to look at http://hibernatingrhinos.com/open-source/rhino-etl to create a process that runs the export for you. rhino.etl includes operations for FileHelpers.