编译器警告(等级 2)CS0437
更新:2007 年 11 月
错误消息
“assembly2”中的类型“type”与“fassembly1”中的导入命名空间“namespace”冲突。请使用“assembly”中定义的类型。
当源文件 file_2 中的类型与 file _1 中的导入命名空间冲突时发出此警告。编译器使用源文件中的类型。
示例
// CS0437_a.cs
// compile with: /target:library
namespace Util
{
public class A {
public void Test() {
System.Console.WriteLine("CS0437_a.cs");
}
}
}
下面的示例生成 CS0437。
// CS0437_b.cs
// compile with: /reference:CS0437_a.dll /W:2
// CS0437 expected
class Util
{
public class A {
public void Test() {
System.Console.WriteLine("CS0437_b.cs");
}
}
}
public class Test
{
public static void Main()
{
Util.A x = new Util.A();
x.Test();
}
}