The syntax T? is shorthand for Nullable<T>. Is there a way I can do something similar to this, but with my own custom characters/etc.?
Like making T! shorthand for MyGeneric<T>.
The syntax T? is shorthand for Nullable<T>. Is there a way I can do something similar to this, but with my own custom characters/etc.?
Like making T! shorthand for MyGeneric<T>.
You can, in a sense. You are not able to use ! because it is not a valid character for identifiers but you could use any other valid characters. That being said, this is very limited. If you know a base type that you are going to use, you can do:
using @c = System.Collections.Generic.List<B>;
Where B is the base class. If you want a more generic version you could do:
using @c = System.Collections.Generic.List<object>;
You could now use @c as if it is a List<B> or `List'. Such as:
@c a = new @c;
a.Add(new B());
Like I said, it is limited and not practical but it is semi-possible.
This can't be done unless you use Roslyn. I believe the closest thing (correct me if I'm wrong) to what you want is something like this:
using YourAlias = System.Collections.Generic.Dictionary<string, string>; // or whatever type you want
and to use it:
var dict = new YourAlias();