UIntPtr UIntPtr UIntPtr UIntPtr Struct

定义

重要

此 API 不符合 CLS。

用于表示指针或句柄的平台特定类型。A platform-specific type that is used to represent a pointer or a handle.

public value class UIntPtr : System::Runtime::Serialization::ISerializable
[System.CLSCompliant(false)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public struct UIntPtr : System.Runtime.Serialization.ISerializable
type unativeint = struct
    interface ISerializable
Public Structure UIntPtr
Implements ISerializable
继承
属性
实现

注解

UIntPtr类型旨在作为其大小是特定于平台的一个整数。The UIntPtr type is designed to be an integer whose size is platform-specific. 也就是说,此类型的实例预期可在 32 位硬件和操作系统,32 位和 64 位硬件和操作系统上的 64 位。That is, an instance of this type is expected to be 32-bits on 32-bit hardware and operating systems, and 64-bits on 64-bit hardware and operating systems.

重要

IntPtr类型是符合 CLS 时UIntPtr类型不是。The IntPtr type is CLS-compliant, while the UIntPtr type is not. IntPtr公共语言运行时中使用类型。Only the IntPtr type is used in the common language runtime. UIntPtr提供类型主要是为了保持与体系结构对称性IntPtr类型。The UIntPtr type is provided mostly to maintain architectural symmetry with the IntPtr type.

UIntPtr类型使用的语言支持指针,并作为一种常见方式引用语言的支持和不支持指针之间的数据。The UIntPtr type can be used by languages that support pointers, and as a common means of referring to data between languages that do and do not support pointers. UIntPtr 此外可以使用对象来保存句柄。UIntPtr objects can also be used to hold handles.

此类型实现ISerializable接口。This type implements the ISerializable interface.

构造函数

UIntPtr(UInt32) UIntPtr(UInt32) UIntPtr(UInt32) UIntPtr(UInt32)

使用指定的 32 位指针或句柄初始化 UIntPtr 的新实例。Initializes a new instance of the UIntPtr structure using the specified 32-bit pointer or handle.

UIntPtr(UInt64) UIntPtr(UInt64) UIntPtr(UInt64) UIntPtr(UInt64)

使用指定的 64 位指针或句柄初始化 UIntPtr 的新实例。Initializes a new instance of UIntPtr using the specified 64-bit pointer or handle.

UIntPtr(Void*) UIntPtr(Void*) UIntPtr(Void*) UIntPtr(Void*)

使用指定的指向未指定类型的指针初始化 UIntPtr 的新实例。Initializes a new instance of UIntPtr using the specified pointer to an unspecified type.

字段

Zero Zero Zero Zero

表示已初始化为零的指针或句柄的只读字段。A read-only field that represents a pointer or handle that has been initialized to zero.

属性

Size Size Size Size

获取此实例的大小。Gets the size of this instance.

方法

Add(UIntPtr, Int32) Add(UIntPtr, Int32) Add(UIntPtr, Int32) Add(UIntPtr, Int32)

为无符号指针的值增加偏移量。Adds an offset to the value of an unsigned pointer.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

返回一个值,该值指示此实例是否等于指定的对象。Returns a value indicating whether this instance is equal to a specified object.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

返回此实例的哈希代码。Returns the hash code for this instance.

Subtract(UIntPtr, Int32) Subtract(UIntPtr, Int32) Subtract(UIntPtr, Int32) Subtract(UIntPtr, Int32)

从无符号指针的值中减去偏移量。Subtracts an offset from the value of an unsigned pointer.

ToPointer() ToPointer() ToPointer() ToPointer()

将此实例的值转换为指向未指定类型的指针。Converts the value of this instance to a pointer to an unspecified type.

ToString() ToString() ToString() ToString()

将此实例的数值转换为其等效的字符串表示形式。Converts the numeric value of this instance to its equivalent string representation.

ToUInt32() ToUInt32() ToUInt32() ToUInt32()

将此实例的值转换成 32 位无符号整数。Converts the value of this instance to a 32-bit unsigned integer.

ToUInt64() ToUInt64() ToUInt64() ToUInt64()

将此实例的值转换成 64 位无符号整数。Converts the value of this instance to a 64-bit unsigned integer.

操作员

Addition(UIntPtr, Int32) Addition(UIntPtr, Int32) Addition(UIntPtr, Int32) Addition(UIntPtr, Int32)

为无符号指针的值增加偏移量。Adds an offset to the value of an unsigned pointer.

Equality(UIntPtr, UIntPtr) Equality(UIntPtr, UIntPtr) Equality(UIntPtr, UIntPtr) Equality(UIntPtr, UIntPtr)

确定 UIntPtr 的两个指定的实例是否相等。Determines whether two specified instances of UIntPtr are equal.

Explicit(Void* to UIntPtr) Explicit(Void* to UIntPtr) Explicit(Void* to UIntPtr) Explicit(Void* to UIntPtr)

将指向未指定类型的指定指针转换为 UIntPtrConverts the specified pointer to an unspecified type to an UIntPtr.

此 API 不兼容 CLS。This API is not CLS-compliant.

Explicit(UIntPtr to UInt64) Explicit(UIntPtr to UInt64) Explicit(UIntPtr to UInt64) Explicit(UIntPtr to UInt64)

将指定的 UIntPtr 的值转换为 64 位无符号整数。Converts the value of the specified UIntPtr to a 64-bit unsigned integer.

Explicit(UIntPtr to Void*) Explicit(UIntPtr to Void*) Explicit(UIntPtr to Void*) Explicit(UIntPtr to Void*)

将指定的 UIntPtr 的值转换为指向未指定类型的指针。Converts the value of the specified UIntPtr to a pointer to an unspecified type.

此 API 不兼容 CLS。This API is not CLS-compliant.

Explicit(UInt64 to UIntPtr) Explicit(UInt64 to UIntPtr) Explicit(UInt64 to UIntPtr) Explicit(UInt64 to UIntPtr)

将 64 位无符号整数的值转换成 UIntPtrConverts the value of a 64-bit unsigned integer to an UIntPtr.

Explicit(UInt32 to UIntPtr) Explicit(UInt32 to UIntPtr) Explicit(UInt32 to UIntPtr) Explicit(UInt32 to UIntPtr)

将 32 位无符号整数的值转换成 UIntPtrConverts the value of a 32-bit unsigned integer to an UIntPtr.

Explicit(UIntPtr to UInt32) Explicit(UIntPtr to UInt32) Explicit(UIntPtr to UInt32) Explicit(UIntPtr to UInt32)

将指定的 UIntPtr 的值转换为 32 位无符号整数。Converts the value of the specified UIntPtr to a 32-bit unsigned integer.

Inequality(UIntPtr, UIntPtr) Inequality(UIntPtr, UIntPtr) Inequality(UIntPtr, UIntPtr) Inequality(UIntPtr, UIntPtr)

确定 UIntPtr 的两个指定的实例是否不等。Determines whether two specified instances of UIntPtr are not equal.

Subtraction(UIntPtr, Int32) Subtraction(UIntPtr, Int32) Subtraction(UIntPtr, Int32) Subtraction(UIntPtr, Int32)

从无符号指针的值中减去偏移量。Subtracts an offset from the value of an unsigned pointer.

显式界面实现

IEquatable<UIntPtr>.Equals(UIntPtr) IEquatable<UIntPtr>.Equals(UIntPtr) IEquatable<UIntPtr>.Equals(UIntPtr) IEquatable<UIntPtr>.Equals(UIntPtr)
ISerializable.GetObjectData(SerializationInfo, StreamingContext) ISerializable.GetObjectData(SerializationInfo, StreamingContext) ISerializable.GetObjectData(SerializationInfo, StreamingContext) ISerializable.GetObjectData(SerializationInfo, StreamingContext)

使用序列化当前的 SerializationInfo 对象所需的所有数据填充 UIntPtr 对象。Populates a SerializationInfo object with the data needed to serialize the current UIntPtr object.

适用于

线程安全性

此类型是线程安全的。This type is thread safe.

另请参阅