Patrick Szalapski
Patrick Szalapski

Reputation: 9439

Any way to have a namespace with an alternative name?

Using VB.net, I have a namespace which I'd like to rename for the future. However, I'd also like to keep the old obsolete namespace for a time to ensure backward-compatibility for our consumers for awhile. Is there a way in .NET to have two namespaces, one ordinary and one that merely is an alternative name for the other?

In other words, I would have two namespaces with duplicate classes and modules. Obviously, I could copy all the code, but I really want to do something like

<Obsolete("Use types in namespace MyCompany.Area.ProjectName instead.")>
Namespace MyCompany.WrongArea.WrongProjectName
    Inherits Namespace MyCompany.Area.ProjectName
End Namespace

(A C# answer would be nice too, if you have it.)

Upvotes: 3

Views: 167

Answers (2)

Patrick Szalapski
Patrick Szalapski

Reputation: 9439

I'm going to go out on a limb and say the answer is simply "no".

Upvotes: 0

AshtonKJ
AshtonKJ

Reputation: 1386

Perhaps you could look at something like namespace aliasing.

See: http://www.devx.com/tips/Tip/34419 for example

Upvotes: 1

Related Questions