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