UIntPtr Struct

Definition

Important

This API is not CLS-compliant.

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

public value class UIntPtr
public value class UIntPtr : IComparable, IComparable<UIntPtr>, IEquatable<UIntPtr>, IFormattable, System::Runtime::Serialization::ISerializable
public value class UIntPtr : IEquatable<UIntPtr>, System::Runtime::Serialization::ISerializable
public value class UIntPtr : System::Runtime::Serialization::ISerializable
[System.CLSCompliant(false)]
public struct UIntPtr
[System.CLSCompliant(false)]
public struct UIntPtr : IComparable, IComparable<UIntPtr>, IEquatable<UIntPtr>, IFormattable, System.Runtime.Serialization.ISerializable
[System.CLSCompliant(false)]
public struct UIntPtr : IEquatable<UIntPtr>, System.Runtime.Serialization.ISerializable
[System.CLSCompliant(false)]
[System.Serializable]
public struct UIntPtr : System.Runtime.Serialization.ISerializable
[System.CLSCompliant(false)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public struct UIntPtr : System.Runtime.Serialization.ISerializable
[System.CLSCompliant(false)]
public struct UIntPtr : System.Runtime.Serialization.ISerializable
type unativeint = struct
type unativeint = struct
    interface IFormattable
    interface ISerializable
type unativeint = struct
    interface ISerializable
Public Structure UIntPtr
Public Structure UIntPtr
Implements IComparable, IComparable(Of UIntPtr), IEquatable(Of UIntPtr), IFormattable, ISerializable
Public Structure UIntPtr
Implements IEquatable(Of UIntPtr), ISerializable
Public Structure UIntPtr
Implements ISerializable
Inheritance
UIntPtr
Attributes
Implements

Remarks

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.

Important

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.

Constructors

UIntPtr(UInt32)

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

UIntPtr(UInt64)

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

UIntPtr(Void*)

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

Fields

Zero

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

Properties

MaxValue
MinValue
Size

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

Methods

Add(UIntPtr, Int32)

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

CompareTo(Object)
CompareTo(UIntPtr)
Equals(Object)

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

Equals(UIntPtr)
GetHashCode()

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

Parse(String)
Parse(String, IFormatProvider)
Parse(String, NumberStyles)
Parse(String, NumberStyles, IFormatProvider)
Subtract(UIntPtr, Int32)

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

ToPointer()

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

ToString()

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

ToString(IFormatProvider)
ToString(String)
ToString(String, IFormatProvider)
ToUInt32()

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

ToUInt64()

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

TryParse(String, NumberStyles, IFormatProvider, UIntPtr)
TryParse(String, UIntPtr)

Operators

Addition(UIntPtr, Int32)

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

Equality(UIntPtr, UIntPtr)

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

Explicit(UInt32 to UIntPtr)

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

Explicit(UInt64 to UIntPtr)

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

Explicit(UIntPtr to UInt32)

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

Explicit(UIntPtr to UInt64)

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

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(Void* to UIntPtr)

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

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

Inequality(UIntPtr, UIntPtr)

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

Subtraction(UIntPtr, Int32)

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

Explicit Interface Implementations

IEquatable<UIntPtr>.Equals(UIntPtr)

返回一个值,该值指示此实例是否与其他无符号整数指针相等。Returns a value that indicates whether this instance is equal to another unsigned integer pointer.

ISerializable.GetObjectData(SerializationInfo, StreamingContext)

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

Applies to

Thread Safety

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

See also