void InitMembers(Type type) { foreach (Type nestedType in type.GetNestedTypes(flags)) { if (!nestedType.IsVisible) { continue; } string name = nestedType.FullName.Replace('+', '.'); InnerClasses.Add(new ReflectionClass(CompilationUnit, nestedType, name, this)); } foreach (FieldInfo field in type.GetFields(flags)) { if (!field.IsPublic && !field.IsFamily) { continue; } if (!field.IsSpecialName) { Fields.Add(new ReflectionField(field, this)); } } foreach (PropertyInfo propertyInfo in type.GetProperties(flags)) { ReflectionProperty prop = new ReflectionProperty(propertyInfo, this); if (prop.IsPublic || prop.IsProtected) { Properties.Add(prop); } } foreach (ConstructorInfo constructorInfo in type.GetConstructors(flags)) { if (!constructorInfo.IsPublic && !constructorInfo.IsFamily) { continue; } Methods.Add(new ReflectionMethod(constructorInfo, this)); } foreach (MethodInfo methodInfo in type.GetMethods(flags)) { if (!methodInfo.IsPublic && !methodInfo.IsFamily) { continue; } if (!methodInfo.IsSpecialName) { Methods.Add(new ReflectionMethod(methodInfo, this)); } } foreach (EventInfo eventInfo in type.GetEvents(flags)) { Events.Add(new ReflectionEvent(eventInfo, this)); } }
void InitMembers(Type type) { foreach (Type nestedType in type.GetNestedTypes(flags)) { // We cannot use nestedType.IsVisible - that only checks for public types, // but we also need to load protected types. if (nestedType.IsNestedPublic || nestedType.IsNestedFamily || nestedType.IsNestedFamORAssem) { string name = this.FullyQualifiedName + "." + nestedType.Name; InnerClasses.Add(new ReflectionClass(CompilationUnit, nestedType, name, this)); } } foreach (FieldInfo field in type.GetFields(flags)) { if (!field.IsPublic && !field.IsFamily && !field.IsFamilyOrAssembly) continue; if (!field.IsSpecialName) { Fields.Add(new ReflectionField(field, this)); } } foreach (PropertyInfo propertyInfo in type.GetProperties(flags)) { ReflectionProperty prop = new ReflectionProperty(propertyInfo, this); if (prop.IsPublic || prop.IsProtected) Properties.Add(prop); } foreach (ConstructorInfo constructorInfo in type.GetConstructors(flags)) { if (!constructorInfo.IsPublic && !constructorInfo.IsFamily && !constructorInfo.IsFamilyOrAssembly) continue; Methods.Add(new ReflectionMethod(constructorInfo, this)); } foreach (MethodInfo methodInfo in type.GetMethods(flags)) { if (!methodInfo.IsPublic && !methodInfo.IsFamily && !methodInfo.IsFamilyOrAssembly) continue; if (!methodInfo.IsSpecialName) { Methods.Add(new ReflectionMethod(methodInfo, this)); } } this.AddDefaultConstructorIfRequired = (this.ClassType == ClassType.Struct || this.ClassType == ClassType.Enum); foreach (EventInfo eventInfo in type.GetEvents(flags)) { Events.Add(new ReflectionEvent(eventInfo, this)); } }
void InitMembers(Type type) { foreach (Type nestedType in type.GetNestedTypes(flags)) { // We cannot use nestedType.IsVisible - that only checks for public types, // but we also need to load protected types. if (nestedType.IsNestedPublic || nestedType.IsNestedFamily || nestedType.IsNestedFamORAssem) { string name = this.FullyQualifiedName + "." + nestedType.Name; InnerClasses.Add(new ReflectionClass(CompilationUnit, nestedType, name, this)); } } foreach (FieldInfo field in type.GetFields(flags)) { if (!field.IsPublic && !field.IsFamily && !field.IsFamilyOrAssembly) continue; if (!field.IsSpecialName) { Fields.Add(new ReflectionField(field, this)); } } foreach (PropertyInfo propertyInfo in type.GetProperties(flags)) { ReflectionProperty prop = new ReflectionProperty(propertyInfo, this); if (prop.IsPublic || prop.IsProtected) Properties.Add(prop); } foreach (ConstructorInfo constructorInfo in type.GetConstructors(flags)) { if (!constructorInfo.IsPublic && !constructorInfo.IsFamily && !constructorInfo.IsFamilyOrAssembly) continue; Methods.Add(new ReflectionMethod(constructorInfo, this)); } foreach (MethodInfo methodInfo in type.GetMethods(flags)) { if (!methodInfo.IsPublic && !methodInfo.IsFamily && !methodInfo.IsFamilyOrAssembly) continue; if (!methodInfo.IsSpecialName) { Methods.Add(new ReflectionMethod(methodInfo, this)); } } this.AddDefaultConstructorIfRequired = (this.ClassType == ClassType.Struct || this.ClassType == ClassType.Enum); foreach (EventInfo eventInfo in type.GetEvents(flags)) { Events.Add(new ReflectionEvent(eventInfo, this)); } }
void InitMembers(Type type) { foreach (Type nestedType in type.GetNestedTypes(flags)) { if (!nestedType.IsVisible) continue; string name = nestedType.FullName.Replace('+', '.'); InnerClasses.Add(new ReflectionClass(CompilationUnit, nestedType, name, this)); } foreach (FieldInfo field in type.GetFields(flags)) { if (!field.IsPublic && !field.IsFamily) continue; if (!field.IsSpecialName) { Fields.Add(new ReflectionField(field, this)); } } foreach (PropertyInfo propertyInfo in type.GetProperties(flags)) { ReflectionProperty prop = new ReflectionProperty(propertyInfo, this); if (prop.IsPublic || prop.IsProtected) Properties.Add(prop); } foreach (ConstructorInfo constructorInfo in type.GetConstructors(flags)) { if (!constructorInfo.IsPublic && !constructorInfo.IsFamily) continue; Methods.Add(new ReflectionMethod(constructorInfo, this)); } foreach (MethodInfo methodInfo in type.GetMethods(flags)) { if (!methodInfo.IsPublic && !methodInfo.IsFamily) continue; if (!methodInfo.IsSpecialName) { Methods.Add(new ReflectionMethod(methodInfo, this)); } } foreach (EventInfo eventInfo in type.GetEvents(flags)) { Events.Add(new ReflectionEvent(eventInfo, this)); } }