Edit

Share via


Compiler Warning (level 2) CS0437

The type 'type' in 'assembly2' conflicts with the imported namespace 'namespace' in 'fassembly1'. Using the type defined in 'assembly'.

This warning is issued when a type in a source file, file_2, conflicts with an imported namespace in file_1. The compiler uses the type in the source file.

Example 1

// CS0437_a.cs  
// compile with: /target:library  
namespace Util
{  
   public class A {  
      public void Test() {  
         System.Console.WriteLine("CS0437_a.cs");  
      }  
   }  
}  

Example 2

The following sample generates 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();  
   }  
}