Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
struct System.​IntPtr
Assembly: System.Runtime
Represents a signed integer where the bit-width is the same as a pointer.
Fields and Constants
public static readonly
nint
Zero
A read-only field that represents a signed integer that has been initialized to zero.
Methods
public
int
CompareTo​(nint value)
value
A signed native integer to compare.
Returns A value that indicates the relative order of the objects being compared. The return value has these meanings:
<list type="table">
<listheader>
<term> Value</term>
<description> Meaning</description>
</listheader>
<item>
<term> Less than zero</term>
<description> This instance precedes <paramref name="value" /> in the sort order.</description>
</item>
<item>
<term> Zero</term>
<description> This instance occurs in the same position in the sort order as <paramref name="value" />.</description>
</item>
<item>
<term> Greater than zero</term>
<description> This instance follows <paramref name="value" /> in the sort order.</description>
</item>
</list>
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
public
int
CompareTo​(object value)
value
An object to compare, or <see langword="null" /> .
Returns A value that indicates the relative order of the objects being compared. The return value has these meanings:
<list type="table">
<listheader>
<term> Value</term>
<description> Meaning</description>
</listheader>
<item>
<term> Less than zero</term>
<description> This instance precedes <paramref name="value" /> in the sort order.</description>
</item>
<item>
<term> Zero</term>
<description> This instance occurs in the same position in the sort order as <paramref name="value" />.</description>
</item>
<item>
<term> Greater than zero</term>
<description> This instance follows <paramref name="value" /> in the sort order.</description>
</item>
</list>
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
public
bool
Equals​(nint other)
other
An object to compare with this object.
Returns <see langword="true" /> if the current object is equal to <paramref name="other" /> ; otherwise, <see langword="false" /> .
Indicates whether the current object is equal to another object of the same type.
public
bool
Equals​(object obj)
obj
An object to compare with this instance or <see langword="null" /> .
Returns <see langword="true" /> if <paramref name="obj" /> is an instance of <see cref="T:System.IntPtr" /> and equals the value of this instance; otherwise, <see langword="false" /> .
Returns a value indicating whether this instance is equal to a specified object.
public
int
GetHashCode​() Returns A 32-bit signed integer hash code.
Returns the hash code for this instance.
public
int
ToInt32​() Returns A 32-bit signed integer equal to the value of this instance.
Converts the value of this instance to a 32-bit signed integer.
public
long
ToInt64​() Returns A 64-bit signed integer equal to the value of this instance.
Converts the value of this instance to a 64-bit signed integer.
public
Void*
ToPointer​() Returns A pointer to <see cref="T:System.Void" /> ; that is, a pointer to memory containing data of an unspecified type.
Converts the value of this instance to a pointer to an unspecified type.
public
string
ToString​() Returns The string representation of the value of this instance.
Converts the numeric value of the current <see cref="T:System.IntPtr" /> object to its equivalent string representation.
public
string
ToString​(IFormatProvider provider)
provider
An object that supplies culture-specific formatting information.
Returns The string representation of the value of this instance as specified by <paramref name="provider" /> .
Converts the numeric value of this instance to its equivalent string representation using the specified format and culture-specific format information.
public
string
ToString​(string format)
format
A format specification that governs how the current <see cref="T:System.IntPtr" /> object is converted.
Returns The string representation of the value of the current <see cref="T:System.IntPtr" /> object.
Converts the numeric value of the current <see cref="T:System.IntPtr" /> object to its equivalent string representation.
public
string
ToString​(string format,
IFormatProvider provider)
format
The format to use.
-or-
A <see langword="null" /> reference ( <see langword="Nothing" /> in Visual Basic) to use the default format defined for the type of the <see cref="T:System.IFormattable" /> implementation.
provider
An object that supplies culture-specific formatting information.
Returns The value of the current instance in the specified format.
Formats the value of the current instance using the specified format.
public
bool
TryFormat​(Span`1 utf8Destination,
Int32& bytesWritten,
ReadOnlySpan`1 format = null,
IFormatProvider provider = null)
public
bool
TryFormat​(Span`1 destination,
Int32& charsWritten,
ReadOnlySpan`1 format = null,
IFormatProvider provider = null)
protected
void
Finalize​()
Inherited from object
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
public
Type
GetType​()
Inherited from object
Returns The exact runtime type of the current instance.
Gets the <see cref="T:System.Type" /> of the current instance.
protected
object
MemberwiseClone​()
Inherited from object
Returns A shallow copy of the current <see cref="T:System.Object" /> .
Creates a shallow copy of the current <see cref="T:System.Object" /> .