Mono.Cecil.MetadataImporter.ImportElementType C# (CSharp) Method

ImportElementType() static private method

static private ImportElementType ( Type type ) : ElementType
type System.Type
return ElementType
        static ElementType ImportElementType(Type type)
        {
            ElementType etype;
            if (!type_etype_mapping.TryGetValue (type, out etype))
                return ElementType.None;

            return etype;
        }

Usage Example

Esempio n. 1
0
        public TypeReference ImportType(Type type, ImportGenericContext context, ImportGenericKind import_kind)
        {
            if (MetadataImporter.IsTypeSpecification(type) || MetadataImporter.ImportOpenGenericType(type, import_kind))
            {
                return(this.ImportTypeSpecification(type, context));
            }
            TypeReference typeReference = new TypeReference(string.Empty, type.Name, this.module, this.ImportScope(type.Assembly), type.IsValueType)
            {
                etype = MetadataImporter.ImportElementType(type)
            };

            if (!MetadataImporter.IsNestedType(type))
            {
                typeReference.Namespace = type.Namespace ?? string.Empty;
            }
            else
            {
                typeReference.DeclaringType = this.ImportType(type.DeclaringType, context, import_kind);
            }
            if (type.IsGenericType)
            {
                MetadataImporter.ImportGenericParameters(typeReference, type.GetGenericArguments());
            }
            return(typeReference);
        }