C# Using alias directives

Posté le mar. 04 avril 2017 dans blog

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;
}

Enjoy!