Reputation:
I have a large namespace: Foo.Bar.Space.Station.Bar and I was to alias is as something shorter like, Station. How do I do that in the using section?
using Foo.Bar.Space.Station.Bar Object ???
so I can do this
Station.Object obj = new ...
instead of
Foo.Bar.Space.Station.Bar.Object obj = new ...
Upvotes: 5
Views: 3736
Reputation: 3213
using Station = Foo.Bar.Space.Station.Bar;
But in my opinion, having two namespaces named Bar is not a very good idea. :) Even if it's not real code.
Upvotes: 4
Reputation: 27717
You can give an alias to a namespace in a using statement.
using Station = Foo.Bar.Space.Station.Bar;
Upvotes: 19