Using the same class belonging to the same namespaces in two different assembly for a project
-
Hi, I am trying to use a class from two different assemblies. This class is contained in the same namespace in the assemblies. These assemblies are referenced in the same project and I want to be able to use both classes. Ex: MyClass is under MyNamespace namespace in Assembly1.dll MyClass is under MyNamespace namespace in Assembly2.dll Assembly1.dll and Assembly2.dll are referenced in MyProject project. How can I use MyClass class from both assemblies. Best Regards
-
Hi, I am trying to use a class from two different assemblies. This class is contained in the same namespace in the assemblies. These assemblies are referenced in the same project and I want to be able to use both classes. Ex: MyClass is under MyNamespace namespace in Assembly1.dll MyClass is under MyNamespace namespace in Assembly2.dll Assembly1.dll and Assembly2.dll are referenced in MyProject project. How can I use MyClass class from both assemblies. Best Regards
-
Hi, I am trying to use a class from two different assemblies. This class is contained in the same namespace in the assemblies. These assemblies are referenced in the same project and I want to be able to use both classes. Ex: MyClass is under MyNamespace namespace in Assembly1.dll MyClass is under MyNamespace namespace in Assembly2.dll Assembly1.dll and Assembly2.dll are referenced in MyProject project. How can I use MyClass class from both assemblies. Best Regards
Do you want to use them as the same class? Then you are out of luck! Do you want to just reference them? Then redesign your classes and let them at least half decent/different names. If you really wanna use them like that, they way you explain, you will have to resort to reflection as the C# compiler cannot handle such ambiguities. top secret xacc-ide 0.0.1
-
Try the following
Assembly1.MyClass class1 = new Assembly1.MyClass(); Assembly2.MyClass class2 = new Assembly2.MyClass();
If you fully qualify your references to the namespaces you should be fine. Kev Pearman MCPLol those are the assembly names, not the namespaces. He mentions both reside in the same namespace, called MyNamespace. top secret xacc-ide 0.0.1
-
Lol those are the assembly names, not the namespaces. He mentions both reside in the same namespace, called MyNamespace. top secret xacc-ide 0.0.1
-
Its monday, you are forgiven! ;P PS: Stop beating me to the posts now! :laugh: top secret xacc-ide 0.0.1
-
Its monday, you are forgiven! ;P PS: Stop beating me to the posts now! :laugh: top secret xacc-ide 0.0.1
-
Do you want to use them as the same class? Then you are out of luck! Do you want to just reference them? Then redesign your classes and let them at least half decent/different names. If you really wanna use them like that, they way you explain, you will have to resort to reflection as the C# compiler cannot handle such ambiguities. top secret xacc-ide 0.0.1