Esempio n. 1
0
        public TypeReference ImportType(Type type, IGenericContext context, ImportGenericType import_type)
        {
            if (IsTypeSpecification(type) || ImportOpenGenericType(type, import_type))
            {
                return(ImportTypeSpecification(type, context));
            }

            var reference = new TypeReference(
                string.Empty,
                type.Name,
                ImportScope(type.Assembly),
                type.IsValueType);

            reference.etype  = ImportElementType(type);
            reference.module = module;

            if (IsNestedType(type))
            {
                reference.DeclaringType = ImportType(type.DeclaringType, context);
            }
            else
            {
                reference.Namespace = type.Namespace;
            }

            if (type.IsGenericType)
            {
                ImportGenericParameters(reference, type.GetGenericArguments());
            }

            return(reference);
        }
Esempio n. 2
0
 static bool ImportOpenGenericType(Type type, ImportGenericType import_type)
 {
     return(type.IsGenericType && type.IsGenericTypeDefinition && import_type == ImportGenericType.OpenType);
 }