コード例 #1
0
        internal ReflectionField(FieldInfo field, ReflectionClass parent)
        {
            this.field  = field;
            this.parent = parent;

            this.attributes =
                new ReflectionAttributeList(this.field.GetCustomAttributes(true).OfType <Attribute>().ToList());
            this.name      = this.field.Name;
            this.fieldType = this.field.FieldType;
        }
コード例 #2
0
        internal ReflectionMethod(MethodInfo method, ReflectionClass parent)
        {
            this.method = method;
            this.parent = parent;

            this.returnType = this.method.ReturnType;
            this.attributes =
                new ReflectionAttributeList(this.method.GetCustomAttributes(true).OfType <Attribute>().ToList());
            this.name       = this.method.Name;
            this.parameters = this.method.GetParameters();
        }
コード例 #3
0
        //  private readonly Type returnType;

        internal ReflectionConstructor(ConstructorInfo method, ReflectionClass parent)
        {
            this.constructor = method;
            this.parent      = parent;

            // this.returnType = this.constructor..ReturnType;
            this.attributes =
                new ReflectionAttributeList(this.constructor.GetCustomAttributes(true).OfType <Attribute>().ToList());
            this.name       = this.constructor.Name;
            this.parameters = this.constructor.GetParameters();
        }
コード例 #4
0
        internal ReflectionClass(Type type)
        {
            this.attributes = new ReflectionAttributeList(type.GetCustomAttributes(true).OfType <Attribute>().ToList());
            this.baseType   = type;
            var propertyInfos   = type.GetProperties().ToList();
            var propertyMethods = propertyInfos.SelectMany(a => new[] { a.GetGetMethod(), a.GetSetMethod() });

            this.properties   = new ReflectionPropertyList(propertyInfos, this);
            this.methods      = new ReflectionMethodList(type.GetMethods().Except(propertyMethods).ToList(), this);
            this.fields       = new ReflectionFieldList(type.GetFields().ToList(), this);
            this.constructors = new ReflectionConstructorList(type.GetConstructors().ToList(), this);
            this.name         = type.Name;
            this.fullName     = type.FullName;
        }
コード例 #5
0
        internal ReflectionProperty(PropertyInfo property, ReflectionClass parent)
        {
            this.property = property;
            this.parent   = parent;

            this.attributes =
                new ReflectionAttributeList(this.property.GetCustomAttributes(true).OfType <Attribute>().ToList());
            this.name         = this.property.Name;
            this.propertyType = this.property.PropertyType;

            var method = this.property.GetGetMethod() ?? this.property.GetGetMethod(true);

            if (method != null)
            {
                this.getMethod = new ReflectionMethod(method, parent);
            }

            method = this.property.GetSetMethod() ?? this.property.GetSetMethod(true);
            if (method != null)
            {
                this.setMethod = new ReflectionMethod(method, parent);
            }
        }