Serves to avoid ambiguity. Imagine the following situation:
using System.Windows.Forms;
using System.Windows.Input;
In these two namespaces
there are common classes. How would the compiler know which class you want? To solve this and still use the using
you can create a nickname (alias
):
using Input = System.Windows.Input;
So you could access, for example: Input.ModifierKeys
not generating any ambiguity because he knows that Input
refers to System.Windows.Input
.
Some also believe it may be good practice, this I no longer know answer correctly.
This response was based on Zv_odd’s reply in https://stackoverflow.com/questions/505262/c-sharp-namespace-alias-whats-the-point (Soen)