is there an enum for all the basic reference types in .net?
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. thanksYou 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)
.
精彩评论