Exemplo n.º 1
0
        internal TypeMetadata(Type type)
            : base(type.Name)
        {
            NamespaceName = type.Namespace;

            if (!DictionaryType.ContainsKey(Name))
            {
                DictionaryType.Add(Name, this);
            }

            BaseType      = EmitExtends(type.BaseType);
            DeclaringType = EmitDeclaringType(type.DeclaringType);
            Type          = GetTypeKind(type);

            EmitModifiers(type);

            if (!type.IsGenericTypeDefinition)
            {
                GenericArguments = null;
            }
            else
            {
                GenericArguments = EmitGenericArguments(type.GetGenericArguments()).ToList();
            }

            Attributes            = EmitAttributes(type.GetCustomAttributes(false).Cast <Attribute>());
            ImplementedInterfaces = EmitImplements(type.GetInterfaces()).ToList();
            NestedTypes           = EmitNestedTypes(type.GetNestedTypes()).ToList();
            Fields       = FieldMetadata.EmitFields(type.GetFields());
            Properties   = PropertyMetadata.EmitProperties(type.GetProperties()).ToList();
            Methods      = MethodMetadata.EmitMethods(type.GetMethods()).ToList();
            Constructors = MethodMetadata.EmitMethods(type.GetConstructors()).ToList();
        }
Exemplo n.º 2
0
 internal TypeMetadata(Type type)
 {
     //m_Type = type;
     m_typeName = type.Name;
     if (!m_typesMetadata.ContainsKey(this.m_typeName))
     {
         m_typesMetadata.Add(this.m_typeName, this);
     }
     m_DeclaringType         = EmitDeclaringType(type.DeclaringType);
     m_Constructors          = MethodMetadata.EmitMethods(type.GetConstructors());
     m_Methods               = MethodMetadata.EmitMethods(type.GetMethods());
     m_NestedTypes           = EmitNestedTypes(type.GetNestedTypes());
     m_ImplementedInterfaces = EmitImplements(type.GetInterfaces());
     m_GenericArguments      = !type.IsGenericTypeDefinition ? null : TypeMetadata.EmitGenericArguments(type.GetGenericArguments());
     m_Modifiers             = EmitModifiers(type);
     m_BaseType              = EmitExtends(type.BaseType);
     m_Properties            = PropertyMetadata.EmitProperties(type.GetProperties());
     m_TypeKind              = GetTypeKind(type);
     //m_Attributes = type.GetCustomAttributes(false).Cast<Attribute>();
 }