views:

352

answers:

2

Out of curiosity, I've created 2 assemblies which both have a class (Class1) with the exact same namespace (Library1). I then create another client referencing those 2 assemblies and try to create an instance of Class1.

The compiler, not surprisingly, gives me a compile-error about the ambiguous reference. Is there any way to explicitly specify the type in the assembly I want to use to avoid the ambiguity?

Note: I know this rarely, if ever at all, happens in practice. It's just a question out of curiosity about language feature.

+1  A: 

I think you should use an extern alias to wrap the assembly namespaces outside of the Global namespace.

CMS
+1  A: 

It happens in practice and is a real pain, the external alias can't always solve the problem. Here's one example of where it's an issue Duplicate Namepsaces.

sipwiz