I need to get fieldinfo in a guaranteed order with respect to declaration order. Right now I\'m using attributes to specify order.
Is there a more automatic way of d
The question is old but not so old... I'm dealing now with the same problem. And I prefer to get the fields in tho order of declaration. The following call should work for a value type or a formatted reference type.
var fields = type.GetFields().OrderBy(f => Marshal.OffsetOf(type, f.Name).ToInt32());
Enjoy!