ImportOpenGenericType() static private method

static private ImportOpenGenericType ( Type type, ImportGenericKind import_kind ) : bool
type System.Type
import_kind ImportGenericKind
return bool
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);
        }