public struct UIntPtr
Object
ValueType
UIntPtr
mscorlib
RuntimeInfrastructure
An implementation-specific type that is used to represent a pointer or a handle.
The UIntPtr type is designed to be an implementation-sized pointer. An instance of this type is expected to be the size of anative unsigned int
for the current implementation.For more information on the
native unsigned int
type, see Partition II of the CLI Specification.[Note: UIntPtr instances can also be used to hold handles.
The IntPtr type is CLS-compliant while the UIntPtr type is not. The UIntPtr type is provided mostly to maintain architectural symmetry with the IntPtr type.
]
CLSCompliantAttribute(false)
System Namespace
UIntPtr Constructors
UIntPtr(uint) Constructor
UIntPtr(ulong) Constructor
UIntPtr Methods
UIntPtr.Equals Method
UIntPtr.GetHashCode Method
UIntPtr.ToPointer Method
UIntPtr.ToString Method
UIntPtr.ToUInt32 Method
UIntPtr.ToUInt64 Method
UIntPtr.op_Equality Method
UIntPtr.op_Inequality Method
UIntPtr Fields
UIntPtr Properties
public UIntPtr(uint value);
Constructs a new UIntPtr structure using the specified UInt32 containing a pointer or a handle.
- value
- A UInt32 containing a pointer or handle.
System.UIntPtr Structure, System Namespace
public UIntPtr(ulong value);
Constructs a new UIntPtr structure using the specified UInt64 containing a pointer or a handle.
- value
- A UInt64 containing a pointer or a handle.
Exception Type Condition OverflowException The current platform is a 32-bit platform and the value of the current instance is greater than System.UInt32.MaxValue.
System.UIntPtr Structure, System Namespace
public override bool Equals(object obj);
Determines whether the current instance and the specified Object represent the same type and value.
- obj
- The Object to compare to the current instance.
true
if obj is a UIntPtr instance and has the same value as the current instance. If obj is a null reference or is not an instance of UIntPtr , returnsfalse
.
[Note: The method overrides System.Object.Equals(System.Object).]
System.UIntPtr Structure, System Namespace
public override int GetHashCode();
Generates a hash code for the current instance.
A Int32 containing the hash code for the current instance.
[Note: The algorithm used to generate the hash code is unspecified.]
[Note: This method overrides System.Object.GetHashCode.]
System.UIntPtr Structure, System Namespace
unsafe public void* ToPointer();
Converts the value of the current instance to a pointer tovoid
.
A pointer tovoid
.
[Note: A pointer tovoid
points to memory containing data of an unspecified type.]
This method is not CLS-compliant. For a CLS-compliant alternative use System.IntPtr.ToPointer.
CLSCompliantAttribute(false)
System.UIntPtr Structure, System Namespace
public override string ToString();
Returns a String representation of the value of the current instance.
A String representation of the current instance.
[Note: If System.UIntPtr.Size for the current instance is 4, System.UIntPtr.ToString is equivalent to System.UInt32.ToString(); otherwise, this method is equivalent toSystem.UInt64.ToString().This method overrides System.Object.ToString.
]
System.UIntPtr Structure, System Namespace
public uint ToUInt32();
Converts the value of the current instance to a UInt32.
A UInt32 containing the same value as the current instance.
Exception Type Condition OverflowException The current platform is not a 32-bit platform and the value of the current instance is greater than System.UInt32.MaxValue .
System.UIntPtr Structure, System Namespace
public ulong ToUInt64();
Converts the value of the current instance to a UInt64.
A UInt64 containing the same value as the current instance.
System.UIntPtr Structure, System Namespace
public static bool operator ==(UIntPtr value1, UIntPtr value2);
Determines whether the two specified instances of UIntPtr represent the same value.
- value1
- The first UIntPtr to compare for equality.
- value2
- The second UIntPtr to compare for equality.
true
if value1 represents the same value as value2; otherwise,false
.
System.UIntPtr Structure, System Namespace
public static bool operator !=(UIntPtr value1, UIntPtr value2);
Determines whether two specified instances of UIntPtr represent different values.
- value1
- The first UIntPtr to compare for inequality.
- value2
- The second UIntPtr to compare for inequality.
true
if value1 represents a different value than value2; otherwise,false
.
System.UIntPtr Structure, System Namespace
public static readonly UIntPtr Zero;
Represents a pointer or handle that has been initialized as zero.
[Note: The value of this field is notnull
, but is instead a pointer which has been assigned the value zero. Use this field to efficiently determine whether an instance of UIntPtr has been set to a value other than zero. For example, if uip is a UIntPtr instance, using uip != UIntPtr.Zero is more efficient than uip != new UIntPtr(0) to test if uip has been set to a value other than zero.]
System.UIntPtr Structure, System Namespace
public static int Size { get; }
Gets the size in bytes of a pointer or a handle for the current implementation.
A Int32 containing the number of bytes of a pointer or handle for the current implementation. The value of this property is equal to the number of bytes contained by thenative unsigned int
type in the current implementation.
This property is read-only.For more information on the
native unsigned int
type, see Partition II of the CLI Specification.
System.UIntPtr Structure, System Namespace