开发者

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.

thanks


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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜