so int is a alias for System.Int32. How can I add my own alias that will be GLOBAL. So instead of
List<int> lLanguageIDs;
I could do
List<LanguageID> lLanguageIDs;
where LanguageID is a alias to int or System.Int32
thanks
Ralph
so int is a alias for System.Int32. How can I add my own alias that will be GLOBAL. So instead of
List<int> lLanguageIDs;
I could do
List<LanguageID> lLanguageIDs;
where LanguageID is a alias to int or System.Int32
thanks
Ralph
Typedef for C# (Type Alias)
FlyFisher
public class MyDictionary : Dictionary<string, string> {}
Not what you're looking for I know, works though. C# Generics cause havok with my attempts at an 80-ish line width.
Luke
Matt Warren
John-at-WSRB
Thanks, I do know about that (I should have said that) but is only works per file. I am looking for something global......
Perhaps System.Int32.AddAlias("LanguageID");
something like that...
Pierce Blaylock
You can by using one of the not well known features of the using directive where you can use it to define a type name of your choice that maps to another type, unfortunately you cannot do this explicitly with C# types, instead you must index CLR types ala:
using LanguageID = System.Int32;
And with that, your your final example will work.