Reputation: 8931
I have an architecture consisting of two DLLs and one executable. Both DLLs define a class with the same name and namespace, but potentially different implementations. What I would like to do is to create an object of each of those classes, and have both of them coexist at the same time.
But as we know a picture says more than a thousand words, so here you go:
The surprising thing is: it actually seems to work! I have implemented a small prototype using lots of reflection to load the DLLs and instantiate the objects.
Now my question is: Why does this work? Shouldn't there be a problem having both of the classes in the same AppDomain? Is it safe to do it this way, or did I just get lucky?
Upvotes: 2
Views: 640
Reputation: 190945
A type is more than its class name and namespace. It also includes assembly information to qualify it. You can compare the AssemblyQualifiedName
property of any System.Type
and see that they are different.
Upvotes: 6