I'm in the process of migrating a library that is written in C++ and has a C# wrapper. The C# wrapper (LibWrapper
) has a set of classes with namespaces, like:
namespace MyNamespace
class MyClass
class MyOtherClass
My new library, LibraryCS
contains the same namespaces and class names as LibWrapper
(per user requirement), so I also have:
namespace MyNamespace
class MyClass
class MyOtherClass
Now that the migration is done, I'm in the process of creating a test that compares the results of using both libraries, to validate the migration. However, when I try to reference MyNamespace.MyClass
I get a compiler error (expectedly!) that says "MyNamespace.MyClass is defined in both LibWrapper and LibraryCS".
Is there any trick around this issue, that will allow me to use two classes with the exact same name but from different assemblies in the same client code?
Alternatively, is there any other way to test this?
Renaming the migrated namespace to something like MyNamespace2
will of course work, but we were asked not to do it, in order to keep the client code easier to migrate.
question from:
https://stackoverflow.com/questions/3018419/class-with-same-name-in-two-assemblies-intentionally 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…