MSDN Library
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

UIntPtr Structure

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

A platform-specific type that is used to represent a pointer or a handle.

This API is not CLS-compliant. 

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

[CLSCompliantAttribute(false)]
public struct UIntPtr

The UIntPtr type exposes the following members.

  NameDescription
Public methodUIntPtr(UInt32)Initializes a new instance of the UIntPtr structure using the specified 32-bit pointer or handle.
Public methodUIntPtr(UInt64)Initializes a new instance of UIntPtr using the specified 64-bit pointer or handle.
Public methodUIntPtr(Void*)Security Critical. Initializes a new instance of UIntPtr using the specified pointer to an unspecified type.
Top

  NameDescription
Public propertyStatic memberSizeGets the size of this instance.
Top

  NameDescription
Public methodStatic memberAddAdds an offset to the value of an unsigned pointer.
Public methodEqualsReturns a value indicating whether this instance is equal to a specified object. (Overrides ValueType.Equals(Object).)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeReturns the hash code for this instance. (Overrides ValueType.GetHashCode().)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodStatic memberSubtractSubtracts an offset from the value of an unsigned pointer.
Public methodToPointerConverts the value of this instance to a pointer to an unspecified type.
Public methodToStringConverts the numeric value of this instance to its equivalent string representation. (Overrides ValueType.ToString().)
Public methodToUInt32Converts the value of this instance to a 32-bit unsigned integer.
Public methodToUInt64Converts the value of this instance to a 64-bit unsigned integer.
Top

  NameDescription
Public operatorStatic memberAdditionAdds an offset to the value of an unsigned pointer.
Public operatorStatic memberEqualityDetermines whether two specified instances of UIntPtr are equal.
Public operatorStatic memberExplicit(UInt32 to UIntPtr)Converts the value of a 32-bit unsigned integer to an UIntPtr.
Public operatorStatic memberExplicit(UInt64 to UIntPtr)Converts the value of a 64-bit unsigned integer to an UIntPtr.
Public operatorStatic memberExplicit(UIntPtr to UInt64)Converts the value of the specified UIntPtr to a 64-bit unsigned integer.
Public operatorStatic memberExplicit(UIntPtr to Void*)Security Critical. Converts the value of the specified UIntPtr to a pointer to an unspecified type.
Public operatorStatic memberExplicit(UIntPtr to UInt32)Converts the value of the specified UIntPtr to a 32-bit unsigned integer.
Public operatorStatic memberExplicit(Void* to UIntPtr)Security Critical. Converts the specified pointer to an unspecified type to a UIntPtr.
Public operatorStatic memberInequalityDetermines whether two specified instances of UIntPtr are not equal.
Public operatorStatic memberSubtractionSubtracts an offset from the value of an unsigned pointer.
Top

  NameDescription
Public fieldStatic memberZeroA read-only field that represents a pointer or handle that has been initialized to zero.
Top

The UIntPtr type is designed to be an integer whose size is platform-specific. 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 noteImportant Note:

The IntPtr type is CLS-compliant, while the UIntPtr type is not. Only the IntPtr type is used in the common language runtime. The UIntPtr type is provided mostly to maintain architectural symmetry with the IntPtr type.

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 objects can also be used to hold handles.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

This type is thread safe.

Show:
© 2016 Microsoft