31 lines
749 B
Markdown
31 lines
749 B
Markdown
Title: C# Using alias directives
|
|
|
|
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](http://download.microsoft.com/download/3/8/8/388e7205-bc10-4226-b2a8-75351c669b09/csharp%20language%20specification.doc),
|
|
Or just try to use it:
|
|
|
|
:::csharp
|
|
// 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;
|
|
}
|
|
|
|
Enjoy!
|