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.​UIntPtr
Assembly: System.Runtime
Implemented Interfaces
- IBinaryInteger`1 (Inherits: IComparableIComparable<​UIntPtr>IEquatable<​UIntPtr>IFormattableIParsable<​UIntPtr>ISpanFormattableISpanParsable<​UIntPtr>IAdditionOperators<​UIntPtr, UIntPtr, UIntPtr>IAdditiveIdentity<​UIntPtr, UIntPtr>IBinaryNumber<​UIntPtr>IBitwiseOperators<​UIntPtr, UIntPtr, UIntPtr>IComparisonOperators<​UIntPtr, UIntPtr, bool>IEqualityOperators<​UIntPtr, UIntPtr, bool>IDecrementOperators<​UIntPtr>IDivisionOperators<​UIntPtr, UIntPtr, UIntPtr>IIncrementOperators<​UIntPtr>IModulusOperators<​UIntPtr, UIntPtr, UIntPtr>IMultiplicativeIdentity<​UIntPtr, UIntPtr>IMultiplyOperators<​UIntPtr, UIntPtr, UIntPtr>INumber<​UIntPtr>INumberBase<​UIntPtr>IUtf8SpanFormattableIUtf8SpanParsable<​UIntPtr>ISubtractionOperators<​UIntPtr, UIntPtr, UIntPtr>IUnaryNegationOperators<​UIntPtr, UIntPtr>IUnaryPlusOperators<​UIntPtr, UIntPtr>IShiftOperators<​UIntPtr, int, UIntPtr>)
- IMinMaxValue`1
- IUnsignedNumber`1 (Inherits: INumberBase<​UIntPtr>IEquatable<​UIntPtr>IFormattableIParsable<​UIntPtr>ISpanFormattableISpanParsable<​UIntPtr>IUtf8SpanFormattableIUtf8SpanParsable<​UIntPtr>IAdditionOperators<​UIntPtr, UIntPtr, UIntPtr>IAdditiveIdentity<​UIntPtr, UIntPtr>IDecrementOperators<​UIntPtr>IDivisionOperators<​UIntPtr, UIntPtr, UIntPtr>IEqualityOperators<​UIntPtr, UIntPtr, bool>IIncrementOperators<​UIntPtr>IMultiplicativeIdentity<​UIntPtr, UIntPtr>IMultiplyOperators<​UIntPtr, UIntPtr, UIntPtr>ISubtractionOperators<​UIntPtr, UIntPtr, UIntPtr>IUnaryNegationOperators<​UIntPtr, UIntPtr>IUnaryPlusOperators<​UIntPtr, UIntPtr>)
- ISerializable
Represents an unsigned integer where the bit-width is the same as a pointer.
Fields and Constants
public static readonly
UIntPtr
Zero
A read-only field that represents an unsigned integer that has been initialized to zero.
Properties
Methods
public static
UIntPtr
Add​(UIntPtr pointer,
int offset)
Adds an offset to an unsigned integer.
Returns A new unsigned integer that reflects the addition of <paramref name="offset" /> to <paramref name="pointer" /> .
pointer
The unsigned integer to add the offset to.
offset
The offset to add.
public static
UIntPtr
Clamp​(UIntPtr value,
UIntPtr min,
UIntPtr max)
Clamps a value to an inclusive minimum and maximum value.
Returns The result of clamping <paramref name="value" /> to the inclusive range of <paramref name="min" /> and <paramref name="max" /> .
value
The value to clamp.
min
The inclusive minimum to which <paramref name="value" /> should clamp.
max
The inclusive maximum to which <paramref name="value" /> should clamp.
public
int
CompareTo​(object value)
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.
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>
value
An object to compare, or <see langword="null" /> .
public
int
CompareTo​(UIntPtr value)
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.
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>
value
An unsigned native integer to compare.
public static
UIntPtr
CreateChecked​(TOther value)
Creates an instance of the current type from a value, throwing an overflow exception for any values that fall outside the representable range of the current type.
Returns An instance of <typeparamref name="TSelf" /> created from <paramref name="value" /> .
value
The value that's used to create the instance of <typeparamref name="TSelf" /> .
public static
UIntPtr
CreateSaturating​(TOther value)
Creates an instance of the current type from a value, saturating any values that fall outside the representable range of the current type.
Returns An instance of <typeparamref name="TSelf" /> created from <paramref name="value" /> , saturating if <paramref name="value" /> falls outside the representable range of <typeparamref name="TSelf" /> .
value
The value that is used to create the instance of <typeparamref name="TSelf" /> .
public static
UIntPtr
CreateTruncating​(TOther value)
Creates an instance of the current type from a value, truncating any values that fall outside the representable range of the current type.
Returns An instance of <typeparamref name="TSelf" /> created from <paramref name="value" /> , truncating if <paramref name="value" /> falls outside the representable range of <typeparamref name="TSelf" /> .
value
The value that is used to create the instance of <typeparamref name="TSelf" /> .
DivRem​(UIntPtr left,
UIntPtr right)
Computes the quotient and remainder of two values.
Returns The quotient and remainder of <paramref name="left" /> divided-by <paramref name="right" /> .
left
The value that <paramref name="right" /> divides.
right
The value that divides <paramref name="left" /> .
public
bool
Equals​(object obj)
Returns a value indicating whether this instance is equal to a specified object.
Returns <see langword="true" /> if <paramref name="obj" /> is an instance of <see cref="T:System.UIntPtr" /> and equals the value of this instance; otherwise, <see langword="false" /> .
obj
An object to compare with this instance or <see langword="null" /> .
public
bool
Equals​(UIntPtr other)
Indicates whether the current object is equal to another object of the same type.
Returns <see langword="true" /> if the current object is equal to the <paramref name="other" /> parameter; otherwise, <see langword="false" /> .
other
An object to compare with this object.
public
int
GetHashCode​()
Returns the hash code for this instance.
Returns A 32-bit signed integer hash code.
public static
bool
IsEvenInteger​(UIntPtr value)
Determines if a value represents an even integral number.
Returns <see langword="true" /> if <paramref name="value" /> is an even integer; otherwise, <see langword="false" /> .
value
The value to be checked.
public static
bool
IsOddInteger​(UIntPtr value)
Determines if a value represents an odd integral number.
Returns <see langword="true" /> if <paramref name="value" /> is an odd integer; otherwise, <see langword="false" /> .
value
The value to be checked.
Returns <see langword="true" /> if <paramref name="value" /> is a power of two; otherwise, <see langword="false" /> .
value
The value to be checked.
public static
UIntPtr
LeadingZeroCount​(UIntPtr value)
Computes the number of leading zeros in a value.
Returns The number of leading zeros in <paramref name="value" /> .
value
The value whose leading zeroes are to be counted.
Returns The log2 of <paramref name="value" /> .
value
The value whose log2 is to be computed.
public static
UIntPtr
Max​(UIntPtr x,
UIntPtr y)
Compares two values to compute which is greater.
Returns <paramref name="x" /> if it is greater than <paramref name="y" /> ; otherwise, <paramref name="y" /> .
x
The value to compare with <paramref name="y" /> .
y
The value to compare with <paramref name="x" /> .
public static
UIntPtr
Min​(UIntPtr x,
UIntPtr y)
Compares two values to compute which is lesser.
Returns <paramref name="x" /> if it is less than <paramref name="y" /> ; otherwise, <paramref name="y" /> .
x
The value to compare with <paramref name="y" /> .
y
The value to compare with <paramref name="x" /> .
public static
UIntPtr
Parse​(ReadOnlySpan<​byte> utf8Text,
NumberStyles style = 7,
IFormatProvider? provider = null)
Parses a span of UTF-8 characters into a value.
Returns The result of parsing <paramref name="utf8Text" /> .
utf8Text
The span of UTF-8 characters to parse.
style
A bitwise combination of number styles that can be present in <paramref name="utf8Text" /> .
provider
An object that provides culture-specific formatting information about <paramref name="utf8Text" /> .
public static
UIntPtr
Parse​(ReadOnlySpan<​byte> utf8Text,
IFormatProvider? provider)
Parses a span of UTF-8 characters into a value.
Returns The result of parsing <paramref name="utf8Text" /> .
utf8Text
The span of UTF-8 characters to parse.
provider
An object that provides culture-specific formatting information about <paramref name="utf8Text" /> .
public static
UIntPtr
Parse​(ReadOnlySpan<​char> s,
NumberStyles style = 7,
IFormatProvider? provider = null)
Converts the read-only span of characters representation of a number in optionally specified style and optionally specified culture-specific format to its unsigned native integer equivalent.
Returns An unsigned native integer equivalent to the number contained in <paramref name="s" /> .
s
A read-only span of characters containing a number to convert.
style
An optional bitwise combination of the enumeration values that indicates the style elements that can be present in <paramref name="s" /> . The default value is <see cref="F:System.Globalization.NumberStyles.Integer" /> .
provider
An optional object that supplies culture-specific formatting information about <paramref name="s" /> . The default value is <see langword="default" /> .
public static
UIntPtr
Parse​(ReadOnlySpan<​char> s,
IFormatProvider? provider)
Parses a span of characters into a value.
Returns The result of parsing <paramref name="s" /> .
s
The span of characters to parse.
provider
An object that provides culture-specific formatting information about <paramref name="s" /> .
public static
UIntPtr
Parse​(string s)
Converts the string representation of a number to its unsigned native integer equivalent.
Returns An unsigned native integer equivalent to the number contained in <paramref name="s" /> .
s
A string containing a number to convert.
public static
UIntPtr
Parse​(string s,
NumberStyles style)
Converts the string representation of a number in a specified style to its unsigned native integer equivalent.
Returns An unsigned native integer equivalent to the number contained in <paramref name="s" /> .
s
A string containing a number to convert.
style
A bitwise combination of the enumeration values that indicates the style elements that can be present in <paramref name="s" /> .
public static
UIntPtr
Parse​(string s,
NumberStyles style,
IFormatProvider? provider)
Converts the string representation of a number in a specified style and culture-specific format to its unsigned native integer equivalent.
Returns An unsigned native integer equivalent to the number contained in <paramref name="s" /> .
s
A string containing a number to convert.
style
A bitwise combination of the enumeration values that indicates the style elements that can be present in <paramref name="s" /> .
provider
An object that supplies culture-specific formatting information about <paramref name="s" /> .
public static
UIntPtr
Parse​(string s,
IFormatProvider? provider)
Converts the string representation of a number in a specified culture-specific format to its unsigned native integer equivalent.
Returns An unsigned native integer equivalent to the number contained in <paramref name="s" /> .
s
A string containing a number to convert.
provider
An object that supplies culture-specific formatting information about <paramref name="s" /> .
public static
UIntPtr
PopCount​(UIntPtr value)
Computes the number of bits that are set in a value.
Returns The number of set bits in <paramref name="value" /> .
value
The value whose set bits are to be counted.
public static
UIntPtr
RotateLeft​(UIntPtr value,
int rotateAmount)
Rotates a value left by a given amount.
Returns The result of rotating <paramref name="value" /> left by <paramref name="rotateAmount" /> .
value
The value that is rotated left by <paramref name="rotateAmount" /> .
rotateAmount
The amount by which <paramref name="value" /> is rotated left.
public static
UIntPtr
RotateRight​(UIntPtr value,
int rotateAmount)
Rotates a value right by a given amount.
Returns The result of rotating <paramref name="value" /> right by <paramref name="rotateAmount" /> .
value
The value that is rotated right by <paramref name="rotateAmount" /> .
rotateAmount
The amount by which <paramref name="value" /> is rotated right.
Returns A positive value if <paramref name="value" /> is positive, <see cref="P:System.Numerics.INumberBase`1.Zero" /> if <paramref name="value" /> is zero, and a negative value if <paramref name="value" /> is negative.
value
The value whose sign is to be computed.
public static
UIntPtr
Subtract​(UIntPtr pointer,
int offset)
Subtracts an offset from an unsigned integer.
Returns A new unsigned integer that reflects the subtraction of <paramref name="offset" /> from <paramref name="pointer" /> .
pointer
The unsigned integer to subtract the offset from.
offset
The offset to subtract.
public
Void*
ToPointer​()
Converts the value of this instance to a pointer to an unspecified type.
Returns A pointer to <see cref="T:System.Void" /> ; that is, a pointer to memory containing data of an unspecified type.
public
string
ToString​()
Converts the numeric value of this instance to its equivalent string representation.
Returns The string representation of the value of this instance.
public
string
ToString​(IFormatProvider? provider)
Converts the numeric value of this instance to its equivalent string representation using the specified format and culture-specific format information.
Returns The string representation of the value of this instance as specified by <paramref name="provider" /> .
provider
An object that supplies culture-specific formatting information.
public
string
ToString​(string format)
Converts the numeric value of this instance to its equivalent string representation, using the specified format.
Returns The string representation of the value of this instance as specified by <paramref name="format" /> .
format
A standard or custom numeric format string.
public
string
ToString​(string format,
IFormatProvider provider)
Formats the value of the current instance using the specified format.
Returns The value of the current instance in the specified format.
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.
public
uint
ToUInt32​()
Converts the value of this instance to a 32-bit unsigned integer.
Returns A 32-bit unsigned integer equal to the value of this instance.
public
ulong
ToUInt64​()
Converts the value of this instance to a 64-bit unsigned integer.
Returns A 64-bit unsigned integer equal to the value of this instance.
public static
UIntPtr
TrailingZeroCount​(UIntPtr value)
Computes the number of trailing zeros in a value.
Returns The number of trailing zeros in <paramref name="value" /> .
value
The value whose trailing zeroes are to be counted.
public
bool
TryFormat​(Span<​byte> utf8Destination,
Int32& bytesWritten,
ReadOnlySpan<​char> format = null,
IFormatProvider? provider = null)
public
bool
TryFormat​(Span<​char> destination,
Int32& charsWritten,
ReadOnlySpan<​char> format = null,
IFormatProvider? provider = null)
public static
bool
TryParse​(ReadOnlySpan<​byte> utf8Text,
NumberStyles style,
IFormatProvider? provider,
UIntPtr& result)
public static
bool
TryParse​(ReadOnlySpan<​byte> utf8Text,
IFormatProvider? provider,
UIntPtr& result)
public static
bool
TryParse​(ReadOnlySpan<​byte> utf8Text,
UIntPtr& result)
public static
bool
TryParse​(ReadOnlySpan<​char> s,
NumberStyles style,
IFormatProvider? provider,
UIntPtr& result)
public static
bool
TryParse​(ReadOnlySpan<​char> s,
IFormatProvider? provider,
UIntPtr& result)
public static
bool
TryParse​(string s,
NumberStyles style,
IFormatProvider provider,
UIntPtr& result)
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
Gets the <see cref="T:System.Type" /> of the current instance.
Returns The exact runtime type of the current instance.
protected
object
MemberwiseClone​()
Inherited from object
Creates a shallow copy of the current <see cref="T:System.Object" /> .
Returns A shallow copy of the current <see cref="T:System.Object" /> .