Subscribe to RSS Subscribe to Comments

George Schizas Blog

Days in the life of a clone

Import and Export in .NET

A common task in making “integration” projects is usually the part where the programmer needs to open an external file, which is in a (very) legacy format and parse this file. This obviously results in large and boring glue code, which bloats the project and makes it scary.Enter FileHelpers, which really simplifies the whole procedure. All you need to do is make a class of your data (actually what one line is) and add one or two attributes. For example:

<FileHelpers.DelimitedRecord(vbTab), FileHelpers.IgnoreFirst()> _
Public Class BicFile
    Public Name As String
    Public Description As String
    Public Amount As Decimal
    <FileHelpers.FieldConverter(FileHelpers.ConverterKind.Date, "yyMMdd")> _
    Public OpenDate As Date
End Class

Obviously this simplifies everything and saves a lot of boring code. The program is open sourced, and it is also available in library format (so that you just add a .dll reference to your project). I wish I found that earlier!

No comments yet. Be the first.

Leave a reply

You must be logged in to post a comment.

© TerraSoft 2003-2018