This documentation is archived and is not being maintained.

Compiler Error CS0434 

Error Message

The namespace NamespaceName1 in NamespaceName2 conflicts with the type TypeName1 in NamespaceName3

This error occurs when the imported type and the imported namespace have the same fully qualified name. When that name is referenced, the compiler is unable to distinguish between the two.

The following code generates error CS0434.

Example

This code creates the first copy of the type with the identical fully qualified name.

// CS0434_1.cs
// compile with: /t:library
namespace TypeBindConflicts 
{
    namespace NsImpAggPubImp 
    {
        public class X { }
    }
}

This code creates the second copy of the type with the identical fully qualified name.

// CS0434_2.cs
// compile with: /t:library
namespace TypeBindConflicts {
    // Conflicts with another import (import2.cs).
    public class NsImpAggPubImp { }
    // Try this instead:
    // public class UniqueClassName { }
}

This code references the type with the identical fully qualified name.

// CS0434.cs
// compile with: /r:cs0434_1.dll /r:cs0434_2.dll
using TypeBindConflicts;
public class Test 
{
    public TypeBindConflicts.NsImpAggPubImp.X n2 = null; // CS0434
}
Show: