/// https://stackoverflow.com/questions/14734374/c-sharp-reflection-property-order public static IEnumerable <Member> GetREDMembers(this CVariable cvar, bool getBuffers) { Type type = cvar.GetType(); Dictionary <Type, int> lookup = new Dictionary <Type, int>(); // get hierarchical list of types int count = 0; lookup[type] = count++; Type parent = type.BaseType; while (parent != null) { lookup[parent] = count; count++; parent = parent.BaseType; } return(cvar.GetREDMembersInternal(getBuffers) .OrderByDescending(prop => lookup[prop.GetMemberInfo().DeclaringType])); }