public static IEnumerable <FieldDef> GetFields(this TypeDef type, bool sortMembers) { if (!sortMembers || !type.CanSortFields()) { return(type.Fields); } var ary = type.Fields.ToArray(); Array.Sort(ary, FieldDefComparer.Instance); return(ary); }