It’s possible to define an alias in C# like this
using kvp = System.Collections.Generic.KeyValuePair<string, string>;
var pair = new kvp("key", "value");
Microsoft define aliases too:
int i;
Int32 i2;
How can we define aliases that are available within a namespace? Is this configurable?
This question is specifically about an alias… so… using inheritance as a proxy isn’t desired. I’m happy with that in many situations… but not when you want the best of both descriptive names and a shorthand version.
You are explicitly asking for an alias and not for a workaround. Therefore, the only answer I have is: There is no way to do this.
The
usingalias that you gave as an example is per file. C# does not have a construct that allows cross-file aliases.