示例#1
0
        public TypeInformation(TypeDefinition def, MetadataContext metadataContext)
        {
            this.definition      = def;
            this.MetadataContext = metadataContext;
            NamespaceChain       = def.Namespace.Split('.');

            foreach (var method in def.Methods)
            {
                var mtd = new MethodInformation(method, metadataContext);
                if (mtd.IsStaticConstructor)
                {
                    StaticConstructor = mtd;
                }
                Methods.Add(mtd);
            }
            foreach (var prop in def.Properties)
            {
                Properties.Add(new PropertyInformation(prop, metadataContext));
            }
            foreach (var field in def.Fields)
            {
                Fields.Add(new FieldInformation(field, metadataContext));
            }
            foreach (var nested in def.NestedTypes)
            {
                Nested.Add(new TypeInformation(nested, metadataContext));
            }


            this.genericParameterTypes = def.GenericParameters.Select(a => MetadataContext.GetTypeInformation(a)).ToArray();
            TypeAttributes             = def.Attributes.ToString().Split(sep, StringSplitOptions.RemoveEmptyEntries);
        }
示例#2
0
        public TypeInformation(GenericInstanceType def, MetadataContext metadataContext)
        {
            reference            = def;
            this.definitionGI    = def;
            this.MetadataContext = metadataContext;
            var ElementType = metadataContext.GetTypeInformation(def.ElementType);

            this.genericElementType   = ElementType;
            this.genericArgumentTypes = def.GenericArguments.Select(a => MetadataContext.GetTypeInformation(a)).ToArray();
            this.definition           = ElementType.definition;
            Methods           = ElementType.Methods;
            StaticConstructor = ElementType.StaticConstructor;
            Properties        = ElementType.Properties;
            Fields            = ElementType.Fields;
            Nested            = ElementType.Nested;
            TypeAttributes    = ElementType.TypeAttributes;
        }