Search code examples
c#reflectionfastmember

FastMember column order preservation


When using TypeAccessor.Create FastMember always seems to return a list of the columns in alphabetic sorted order. Is it possible to tell it to preserve the ordering of the columns in the class?

for example:

var testClass = new { B = "1", A = "2" };

will return column A then B from GetMembers, I'd like to get it to preserve the ordering of B then A if possible.


Solution

  • Looks like Evk is right and it can't really be done via the standard APIs. In the interest of completeness I'll leave this as the answer.