tags:

views:

69

answers:

1

well i want an enum i can use in switch function.
i need to get that enum using something like iValue.GetType().somethingidontknow()
so basically this system enum should contain all the basic reference types like int , string , long and so on.
thanks

+8  A: 

You might want System.TypeCode. You can use Convert.GetTypeCode to get the TypeCode for an object or Type.GetTypeCode to get the TypeCode for a type. Note that this will be TypeCode.Object for any type that doesn't have its own value in the enumeration.


Edit: In case this is related to your other recent question, there is an overload of Convert.ChangeType that takes a TypeCode, so you can do things like Convert.ChangeType("123", TypeCode.Int32).

Quartermeister
thanks, its a little related to my other question, i am still thinking of implementing my own switch for convertion function Convert<T>(String) so this why i need this enum.
Karim