Creating Type Aliases in C#

added by BlackWasp
5/16/2012 8:26:53 AM

5 Kicks, 389 Views

The using directive of the C# programming language is often used to create namespace aliases, allowing types with matching names that appear in separate namespaces to be easily accessed. A lesser known use of the directive is to create aliases for types.


2 comments

dpeterson
5/16/2012 8:24:05 AM
I've used them for disambiguation before, but not for generics. That's a pretty nice shortcut.

wladek
5/17/2012 6:55:59 AM
IMO disambiguation should be the only use. I don't think it makes source any easier to read. The extra layer of naming abstraction when used with common .NET data types results in more obfuscated code.