private static void GetItems(Type type, XBindingFlags flags, List <XFieldInfo> fields, List <XPropertyInfo> properties, List <XEventInfo> events, List <XIndexerInfo> indexers, List <XMethodInfo> methods) { if (type.BaseType != null && (flags & XBindingFlags.InheritedMembers) != 0) { GetItems(type.BaseType, flags, fields, properties, events, indexers, methods); } if ((flags & XBindingFlags.Field) != 0) { foreach (var item in type.GetFields(AsBindingFlags(flags))) { fields.Add(XFieldInfo.Create(item, flags)); } } if ((flags & (XBindingFlags.Property | XBindingFlags.Indexer)) != 0) { foreach (var item in type.GetProperties(AsBindingFlags(flags))) { var parameters = item.GetIndexParameters(); if (parameters != null && parameters.Length != 0) { if ((flags & XBindingFlags.Indexer) != 0) { indexers.Add(XIndexerInfo.Create(item, flags)); } } else { if ((flags & XBindingFlags.Property) != 0) { properties.Add(XPropertyInfo.Create(item, flags)); } } } } if ((flags & XBindingFlags.Event) != 0) { foreach (var item in type.GetEvents(AsBindingFlags(flags))) { events.Add(XEventInfo.Create(item, flags)); } } if ((flags & XBindingFlags.Method) != 0) { foreach (var item in type.GetMethods(AsBindingFlags(flags))) { methods.Add(XMethodInfo.Create(item, flags)); } } }
void GetItems(Type type, XBindingFlags flags) { if (type.BaseType != null) { GetItems(type.BaseType, flags); } if ((flags & XBindingFlags.Field) != 0) { var fields = type.GetFields(AsBindingFlags(flags)); foreach (var item in fields) { this.fields[item.Name] = XFieldInfo.Create(item, flags); } } if ((flags & (XBindingFlags.Property | XBindingFlags.Indexer)) != 0) { var properties = type.GetProperties(AsBindingFlags(flags)); foreach (var item in properties) { var parameters = item.GetIndexParameters(); if (parameters != null && parameters.Length != 0) { if ((flags & XBindingFlags.Indexer) != 0) { indexers[new RuntimeParamsSign(ParametersToTypes(parameters))] = XIndexerInfo.Create(item, flags); } } else { if ((flags & XBindingFlags.Property) != 0) { this.properties[item.Name] = XPropertyInfo.Create(item, flags); } } } } if ((flags & XBindingFlags.Method) != 0) { var methods = type.GetMethods(AsBindingFlags(flags)); foreach (var item in methods) { this.methods[new RuntimeMethodSign(item.Name, ParametersToTypes(item.GetParameters()))] = XMethodInfo.Create(item, flags); } } }