Using alias for generic types

Topics: C# Language Design
Dec 16, 2014 at 8:35 AM
It would be nice to have the possibility of writing things like:
using Foo<T> = Namespace.Classname<T, T>
Now, I guess it would mean putting some heavy constrains on:
  1. what goes to the right of '='
  2. what goes inside the <> while using Foo
because otherwise you get infinite recursion and other nasty things.
Dec 16, 2014 at 9:08 AM
You can already use generic types:
using IE = System.Collections.Generic.IEnumerable<object>;
I like your idea, but I'd go one step further:
using StringDictionary<TValue> = System.Collections.Generic.Dictionary<string, TValue>;
Feb 17, 2015 at 7:19 AM
This is a sensible idea. I have often wanted this feature.
Feb 25, 2015 at 4:23 AM
The Roslyn team no longer uses this site. Your comments are most welcome over at