public static List <MemberEntry <T> > GenerateList <T>(MemberOptions options) { PropertyInfo[] properties = (options & MemberOptions.Properties) == 0 ? new PropertyInfo[0] : typeof(T).GetProperties(bf); FieldInfo[] fields = (options & MemberOptions.Fields) == 0 ? new FieldInfo[0] : typeof(T).GetFields(bf); var members = properties.Where(p => p.GetIndexParameters().Length == 0).Cast <MemberInfo>() .Concat(fields.Cast <MemberInfo>()).OrderBy(e => e.MetadataToken).ToArray(); var result = members.Select(m => new MemberEntry <T>( m.Name, m, options.IsSet(MemberOptions.Getter | MemberOptions.Typed) ? ReflectionTools.CreateGetter <T>(m) : null, options.IsSet(MemberOptions.Getter | MemberOptions.Untyped) ? ReflectionTools.CreateGetterUntyped(typeof(T), m) : null, options.IsSet(MemberOptions.Setters | MemberOptions.Typed) ? ReflectionTools.CreateSetter <T>(m) : null, options.IsSet(MemberOptions.Setters | MemberOptions.Untyped) ? ReflectionTools.CreateSetterUntyped(typeof(T), m) : null )).ToList(); return(result); }