C#中的原始数据类型 [英] Primitive data type in C#
本文介绍了C#中的原始数据类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个疑问,如果是的话,C#是否具有原始数据类型,那么如何知道一个数据类型是原始数据类型,以及该数据类型成为原始数据类型的规则是什么,任何人都可以给我一个链接,其中我可以在
解决方案
上了解更多信息该规则使用了反射:对于变量v
,调用v.GetType()
,对于类型T,调用.这两个表达式都将返回类型为 System.Type
的对象.检查实例属性System.Type.IsPrimitive
.
有关类型概述,请阅读本文: http://msdn.microsoft.com/en-us/magazine/cc301569.aspx [^ ].注意拳击.
有关更多详细信息,请参见: http://msdn.microsoft.com/en-us/library/ms173104. aspx [ ^ ].
对于类型Type
概述(反射),请阅读以下MSDN帮助页面: http://msdn .microsoft.com/en-us/library/system.type.aspx [ ^ ].
有关更多信息,请阅读本教程: http://www.brainbell.com/tutors/C_Sharp/The_Type_System.htm [^ ].
-SA
请参见 http: //lmgtfy.com/?q=c%23+primitive+data+type [ ^ ]-我看到的第一个链接会成功!
尝试这些链接-
专有和非原始 [原始数据类型示例
>
I had a Q does C# have primitive data type if yes then how to know that a data type is of primitive type and what are the rules for a data type to be a primitive data type can any one give me a link where i could learn more on this
解决方案
The rule is using Reflection: for a variablev
, callv.GetType()
, or for a type T, calltypeof(T)
. Both expression will return an object of the typeSystem.Type
. Check the instance propertySystem.Type.IsPrimitive
.
For type overview, read this article: http://msdn.microsoft.com/en-us/magazine/cc301569.aspx[^]. Pay attention for boxing.
For more detail, see: http://msdn.microsoft.com/en-us/library/ms173104.aspx[^].
For the typeType
overview (Reflection), read this MSDN help page: http://msdn.microsoft.com/en-us/library/system.type.aspx[^].
For more information, read this tutorial: http://www.brainbell.com/tutors/C_Sharp/The_Type_System.htm[^].
—SA
See http://lmgtfy.com/?q=c%23+primitive+data+type[^] - first link I see will do!
try these links--
Premitive and nonprimitive [^]
Primitive Data Type Examples
这篇关于C#中的原始数据类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文