Namespace conflicts and type aliasing
As your applications get more complicated, you'll start to section off your code into namespaces, ensuring that you have control over where and when it's accessed. You'll also use third-party software tools and plugins to save on time implementing a feature from the ground up that someone else has already made available. Both of these scenarios show that you're progressing with your programming knowledge, but they can also cause namespace conflicts.
Namespace conflicts happen when there are two or more classes or types with the same name, which happens more than you'd think.
Good naming habits tend to produce similar results, and before you know it, you're dealing with multiple classes named Error
or Extension
, and Visual Studio is throwing out errors. Luckily, C# has a simple solution to these situations: type aliasing.
Defining a type alias lets you explicitly choose which conflicting type you want...