Example #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;
        }
        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();
        }
        //  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();
        }
        public static ReflectionClass GetReflection(Type t)
        {
            if (t == null)
            {
                throw new NullReferenceReflectionException();
            }

            if (!Cache.ContainsKey(t))
            {
                Cache[t] = new ReflectionClass(t);
            }

            return Cache[t];
        }
Example #5
0
        public static ReflectionClass GetReflection(Type t)
        {
            if (t == null)
            {
                throw new NullReferenceReflectionException();
            }

            if (!Cache.ContainsKey(t))
            {
                Cache[t] = new ReflectionClass(t);
            }

            return(Cache[t]);
        }
Example #6
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);
            }
        }
 internal ReflectionMethodList(List <MethodInfo> methods, ReflectionClass parent)
 {
     this.AddRange(from method in methods select new ReflectionMethod(method, parent));
 }
 internal ReflectionPropertyList(List <PropertyInfo> properties, ReflectionClass parent)
 {
     this.AddRange(properties.Select(a => new ReflectionProperty(a, parent)));
     this.ForEach(a => this.cache.Add(a.Name, a));
 }
 internal ReflectionFieldList(List <FieldInfo> fields, ReflectionClass parent)
 {
     this.AddRange(fields.Select(a => new ReflectionField(a, parent)));
     this.ForEach(a => this.cache.Add(a.Name, a));
 }
 internal ReflectionConstructorList(List <ConstructorInfo> contructors, ReflectionClass parent)
 {
     this.AddRange(contructors.Select(a => new ReflectionConstructor(a, parent)));
     this.ForEach(a => this.cache.Add(a.Name, a));
 }