【发布时间】:2011-11-15 07:14:19
【问题描述】:
System.Type 类持有“IsPointer”属性的主要原因是什么?
我读过它可以用作“Isprimitive”来检查类型是否是原始的。对吗?
【问题讨论】:
标签: c# system.type
System.Type 类持有“IsPointer”属性的主要原因是什么?
我读过它可以用作“Isprimitive”来检查类型是否是原始的。对吗?
【问题讨论】:
标签: c# system.type
primitive types 是 Boolean、Byte、SByte、Int16、UInt16、Int32、UInt32、Int64、UInt64、Char、Double 和 Single。
IsPointer - 表示 Type 是否为指针。 unsafe block:
甚至可以在 C# 中声明指针调用unsafe struct Node
{
public Node* NextNode;
}
【讨论】:
引用MSDN:
Type.IsPointer属性 - 获取一个值,该值指示Type是否为指针。
Type.IsPrimitive属性 - 获取一个值,该值指示Type是否是原始类型之一。
【讨论】: