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); }
private static string NormalizeTypeFullName(Type type) { if (!MetadataImporter.IsNestedType(type)) { return(type.FullName); } return(string.Concat(MetadataImporter.NormalizeTypeFullName(type.DeclaringType), "/", type.Name)); }