編譯器警告 (層級 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();
}
}