Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7062447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:35:42+00:00 2026-05-28T04:35:42+00:00

I downloaded FileHelpers from nuget but I am not sure if this feature does

  • 0

I downloaded FileHelpers from nuget but I am not sure if this feature does not exist or if I don’t have the right version or what.

I been looking around and it seems that FileHelpers may have an attribute to specify the field order.

I downloaded this one however when I was looking in nuget there seems to be another version

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T04:35:42+00:00Added an answer on May 28, 2026 at 4:35 am

    Firstly, the FieldOrder attribute does not exist in FileHelpers 2.0. In FileHelpers 2.9.9 (also available via NuGet), the attribute exists but if you specify it for any field, you must specify it for all fields. In general, however, use of the attribute is no necessary, since the order of the fields is defined by the format.

    When using FileHelpers you provide a class to describe your format, e.g.,

    [DelimitedRecord("|")] 
    public class Order 
    { 
       // First field
       public int OrderID; 
    
       // Second field
       public string CustomerID; 
    
       // Third field
       [FieldConverter(ConverterKind.Date, "ddMMyyyy")]   
       public DateTime OrderDate;    
    }
    

    This describes a format with three fields, separated by vertical bars. If you like, it is the specification of the format. Once defined you can use it to import and export:

    FileHelperEngine engine = new FileHelperEngine(typeof(Order)); 
    
    // To read use: 
    Order[] orders = engine.ReadFile("FileIn.txt") as Order[]; 
    
    // To write use: 
    engine.WriteFile("FileOut.txt", orders); 
    

    So, if you want your fields in a different order, you should modify your Order class.

    Now if you really wanted to, (with FileHelpers 2.9.9), you could change the order of the fields as follows:

    [DelimitedRecord("|")] 
    public class Order 
    { 
       // Third field
       [FieldOrder(3)]
       public int OrderID; 
    
       // Second field
       [FieldOrder(2)]
       public string CustomerID; 
    
       // First field
       [FieldOrder(1)]
       [FieldConverter(ConverterKind.Date, "ddMMyyyy")]   
       public DateTime OrderDate;    
    }
    

    but it is cleaner to avoid the use of the FieldOrder attribute and modify the order of the fields within the class instead.

    On the other hand, if you need to specify the field order at runtime, you should build the Order class at using runtime records. You can use a string

    Type orderType = ClassBuilder.ClassFromString(stringContainingOrderClassInCSharp); 
    
    FileHelperEngine engine = new FileHelperEngine(orderType); 
    Order[] orders = engine.ReadFile("FileIn.txt") as Order[]; 
    

    Or you can use a ClassBuilder:

    DelimitedClassBuilder cb = new DelimitedClassBuilder("Order");
    // First field
    cb.AddField("OrderID", typeof(int));
    // Second field
    cb.AddField("CustomerID", 8, typeof(string));
    // Third field
    cb.AddField("OrderDate", typeof(DateTime));
    cb.LastField.Converter.Kind = ConverterKind.Date; 
    cb.LastField.Converter.Arg1 = "ddMMyyyy";
    
    engine = new FileHelperEngine(cb.CreateRecordClass());
    Order[] orders = engine.ReadFile("FileIn.txt") as Order[]; 
    

    You can use whatever logic you like in order to add your fields in the necessary order.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I downloaded the files for jqGrid but I'm not quite sure what files I
I downloaded Eclipse-Juno Version: 4.2.0 . But I am not able to install Android
I downloaded GNUStep and installed it, however I am not sure where I can
I downloaded HTTP::Daemon::SSL for Strawberry Perl 5.10 from CPAN and ran this example: use
Downloaded the WCF REST Template from this location. The default response format is XML,
I downloaded around 1000 images from URLs to the iPhone file system, but I'd
I downloaded GCC 4.5 from http://www.netgull.com/gcc/releases/gcc-4.5.0/ but when I try to setup / build
I downloaded the latest source of mod_wsgi from https://code.google.com/p/modwsgi/source/checkout , but I can’t compile
I downloaded the avalon wizard but I can't find anywhere any sample code. Does
I downloaded Punjab from Github . I also have Python 2.7, Twisted Python 10.2,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.