Just found in section 9.4.1 of the C# language specification :
The using keyword can be used to alias a namespace or a type name :
using-alias-directive:
using identifier = namespace-or-type-name ;
You can read more about that here : csharp language specification.doc
Or just try to use it :
// As the specification show it : namespace N1.N2 { class A {} } namespace N3 { using A = N1.N2.A; class B: A {} } // My foobar exemple : namespace Foo { using Bar = Dictionary<string, string>; } |
Enjoy !
yup, I’ve used this technique to hide generics complexity
http://ebersys.blogspot.com/2006/08/hiding-generics-complexity.html
Yeah.
We’ve been using this in our CMS system because we have our own “File” and incidentally it uses System.IO.File too so we need to specify that using File = ournamespace.File; and then just use the fully-qualified name for IO Files.