共用方式為


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