Is it possible to have a single class reside within two name-spaces and how can I do this?
To clarify: We have a class library (let say root namespace is classLib1),
As a work around you can 'using' the class into the second namespace when you need it:
namespace classLib1.section2
{
public myBigClass
{
and in every file which uses it in the old namespace you can add one line
namespace classLib1.section1
{
using myBigClass = classLib1.section2.myBigClass;
as a temporary patch-up until you've fixed this properly.
No, there is no way to give a single class two names (the namespace is actually just a part of the class name).
As a workaround, you could move the classes to their new location, and create thin wrappers around them at the old location (Facade Pattern). A better solution, of course, would be to move the classes and fix the legacy code accordingly.
Type Forwarding was introduced in .net 2.0, which means you can use the TypeForwardedToAttribute attribute to indicate that a type which was originally present in AssemblyX is now to be found in AssemblyY.
I'm fairly sure this is only appropriate/applicable if you're separating out into multiple assemblies, but is worth knowing even if not.