public static AssemblyNameReference GetAssemblyNameReference(this IMetadataScope scope) { MetadataScopeType metadataScopeType = scope.MetadataScopeType; if (metadataScopeType != MetadataScopeType.AssemblyNameReference) { if (metadataScopeType != MetadataScopeType.ModuleDefinition) { throw new NotSupportedException(string.Format("Metadata scope type {0} is not supported.", scope.MetadataScopeType)); } return(((ModuleDefinition)scope).Assembly.Name); } return((AssemblyNameReference)scope); }
private static string GetScopeFullName(TypeReference type) { IMetadataScope scope = type.Scope; MetadataScopeType metadataScopeType = scope.MetadataScopeType; if (metadataScopeType == MetadataScopeType.AssemblyNameReference) { return(((AssemblyNameReference)scope).FullName); } if (metadataScopeType != MetadataScopeType.ModuleDefinition) { throw new ArgumentException(); } return(((ModuleDefinition)scope).Assembly.Name.FullName); }