【问题标题】:System.Type class and the IsPointer propertySystem.Type 类和 IsPointer 属性
【发布时间】:2011-11-15 07:14:19
【问题描述】:

System.Type 类持有“IsPointer”属性的主要原因是什么?

我读过它可以用作“Isprimitive”来检查类型是否是原始的。对吗?

【问题讨论】:

    标签: c# system.type


    【解决方案1】:

    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;
    }
    

    【讨论】:

      【解决方案2】:

      引用MSDN:

      Type.IsPointer 属性 - 获取一个值,该值指示 Type 是否为指针。

      Type.IsPrimitive 属性 - 获取一个值,该值指示 Type 是否是原始类型之一。

      【讨论】:

        猜你喜欢
        • 2012-03-09
        • 2015-09-20
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-11-24
        • 1970-01-01
        相关资源
        最近更新 更多