Is it possible to determine an object type’s alias(es) through reflection? Given the following example where myObject is of type System.Int32 — e.g
Type t = myObject.GetType();
t.Name will be Int32. However, I would like to identify the possibile alias(es), if any, of the objects in question, so that I could resolve the type name of int in addition to Int32
I’m not looking to spend a huge amount of time on this. If there isn’t an extreamely simple, built in solution, I’ll just map the values myself. =)
Not directly with reflection, there is not. The “type name” (as you are calling it) “int” is not a type name at all, but a language keyword.
You could, of course, use a dictionary to store the look ups from type names to the shorter convenience forms. But there is nothing in the reflection API’s that will do that for you.