11[TypeForwardedFrom(
"mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
12public readonly
struct UInt64 :
IComparable,
IConvertible,
ISpanFormattable,
IFormattable,
IComparable<ulong>,
IEquatable<ulong>,
IBinaryInteger<ulong>,
IBinaryNumber<ulong>,
IBitwiseOperators<ulong, ulong, ulong>,
INumber<ulong>,
IAdditionOperators<ulong, ulong, ulong>,
IAdditiveIdentity<ulong, ulong>,
IComparisonOperators<ulong, ulong>,
IEqualityOperators<ulong, ulong>,
IDecrementOperators<ulong>,
IDivisionOperators<ulong, ulong, ulong>,
IIncrementOperators<ulong>,
IModulusOperators<ulong, ulong, ulong>,
IMultiplicativeIdentity<ulong, ulong>,
IMultiplyOperators<ulong, ulong, ulong>,
ISpanParseable<ulong>,
IParseable<ulong>,
ISubtractionOperators<ulong, ulong, ulong>,
IUnaryNegationOperators<ulong, ulong>,
IUnaryPlusOperators<ulong, ulong>,
IShiftOperators<ulong, ulong>,
IMinMaxValue<ulong>,
IUnsignedNumber<ulong>
16 public const ulong
MaxValue = 18446744073709551615uL;
20 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
23 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
26 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
29 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
32 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
35 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
44 if (
value is ulong num)
72 public override bool Equals([NotNullWhen(
true)]
object?
obj)
78 return this == (ulong)
obj;
89 return (
int)
this ^ (int)(
this >> 32);
161 public static bool TryParse([NotNullWhen(
true)]
string?
s, out ulong result)
273 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
279 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
285 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
291 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
297 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
303 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
309 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
315 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
321 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
327 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
333 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
339 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
345 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
351 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
354 return left <= right;
357 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
363 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
366 return left >= right;
369 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
375 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
381 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
384 return left == right;
387 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
390 return left != right;
393 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
399 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
405 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
411 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
417 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
424 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
427 if (typeof(TOther) == typeof(
byte))
429 return (
byte)(object)
value;
431 if (typeof(TOther) == typeof(
char))
433 return (
char)(object)
value;
435 if (typeof(TOther) == typeof(decimal))
437 return (ulong)(decimal)(
object)
value;
441 if (typeof(TOther) == typeof(
double))
443 return (ulong)(double)(
object)
value;
445 if (typeof(TOther) == typeof(
short))
449 if (typeof(TOther) == typeof(
int))
451 return (ulong)(int)(
object)
value;
453 if (typeof(TOther) == typeof(
long))
455 return (ulong)(long)(
object)
value;
457 if (typeof(TOther) == typeof(
IntPtr))
461 if (typeof(TOther) == typeof(sbyte))
463 return (ulong)(sbyte)(
object)
value;
465 if (typeof(TOther) == typeof(
float))
467 return (ulong)(float)(
object)
value;
469 if (typeof(TOther) == typeof(ushort))
471 return (ushort)(object)
value;
473 if (typeof(TOther) == typeof(uint))
475 return (uint)(object)
value;
477 if (typeof(TOther) == typeof(ulong))
479 return (ulong)(object)
value;
482 if (typeof(TOther) == typeof(
UIntPtr))
491 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
494 if (typeof(TOther) == typeof(
byte))
496 return (
byte)(object)
value;
498 if (typeof(TOther) == typeof(
char))
500 return (
char)(object)
value;
502 if (typeof(TOther) == typeof(decimal))
504 decimal num = (decimal)(
object)
value;
505 if (!(num > 18446744073709551615m))
513 return ulong.MaxValue;
515 if (typeof(TOther) == typeof(
double))
517 double num2 = (double)(
object)
value;
518 if (!(num2 > 1.8446744073709552
E+19))
526 return ulong.MaxValue;
528 if (typeof(TOther) == typeof(
short))
537 if (typeof(TOther) == typeof(
int))
539 int num4 = (int)(
object)
value;
546 if (typeof(TOther) == typeof(
long))
548 long num5 = (long)(
object)
value;
555 if (typeof(TOther) == typeof(
IntPtr))
558 if ((nint)intPtr >= 0)
560 return (ulong)(nint)intPtr;
564 if (typeof(TOther) == typeof(sbyte))
566 sbyte b = (sbyte)(
object)
value;
573 if (typeof(TOther) == typeof(
float))
575 float num6 = (float)(
object)
value;
576 if (!(num6 > 1.8446744
E+19f))
584 return ulong.MaxValue;
586 if (typeof(TOther) == typeof(ushort))
588 return (ushort)(object)
value;
590 if (typeof(TOther) == typeof(uint))
592 return (uint)(object)
value;
594 if (typeof(TOther) == typeof(ulong))
596 return (ulong)(object)
value;
598 if (typeof(TOther) == typeof(
UIntPtr))
607 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
610 if (typeof(TOther) == typeof(
byte))
612 return (
byte)(object)
value;
614 if (typeof(TOther) == typeof(
char))
616 return (
char)(object)
value;
618 if (typeof(TOther) == typeof(decimal))
620 return (ulong)(decimal)(
object)
value;
622 if (typeof(TOther) == typeof(
double))
624 return (ulong)(double)(
object)
value;
626 if (typeof(TOther) == typeof(
short))
630 if (typeof(TOther) == typeof(
int))
632 return (ulong)(int)(
object)
value;
634 if (typeof(TOther) == typeof(
long))
636 return (ulong)(long)(
object)
value;
638 if (typeof(TOther) == typeof(
IntPtr))
642 if (typeof(TOther) == typeof(sbyte))
644 return (ulong)(sbyte)(
object)
value;
646 if (typeof(TOther) == typeof(
float))
648 return (ulong)(float)(
object)
value;
650 if (typeof(TOther) == typeof(ushort))
652 return (ushort)(object)
value;
654 if (typeof(TOther) == typeof(uint))
656 return (uint)(object)
value;
658 if (typeof(TOther) == typeof(ulong))
660 return (ulong)(object)
value;
662 if (typeof(TOther) == typeof(
UIntPtr))
670 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
676 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
682 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
688 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
691 return Parse(
s, style, provider);
694 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
697 return Parse(
s, style, provider);
700 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
703 return (ulong)((
value != 0
L) ? 1 : 0);
707 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
710 if (typeof(TOther) == typeof(
byte))
712 result = (byte)(
object)
value;
715 if (typeof(TOther) == typeof(
char))
717 result = (char)(
object)
value;
720 if (typeof(TOther) == typeof(decimal))
722 decimal num = (decimal)(
object)
value;
723 if (num < 0m || num > 18446744073709551615m)
731 if (typeof(TOther) == typeof(
double))
733 double num2 = (double)(
object)
value;
734 if (num2 < 0.0 || num2 > 1.8446744073709552
E+19)
739 result = (ulong)num2;
742 if (typeof(TOther) == typeof(
short))
750 result = (ulong)num3;
753 if (typeof(TOther) == typeof(
int))
755 int num4 = (int)(
object)
value;
761 result = (ulong)num4;
764 if (typeof(TOther) == typeof(
long))
766 long num5 = (long)(
object)
value;
772 result = (ulong)num5;
775 if (typeof(TOther) == typeof(
IntPtr))
778 if ((nint)intPtr < 0)
783 result = (ulong)(nint)intPtr;
786 if (typeof(TOther) == typeof(sbyte))
788 sbyte b = (sbyte)(
object)
value;
797 if (typeof(TOther) == typeof(
float))
799 float num6 = (float)(
object)
value;
800 if (num6 < 0f || num6 > 1.8446744
E+19f)
805 result = (ulong)num6;
808 if (typeof(TOther) == typeof(ushort))
810 result = (ushort)(
object)
value;
813 if (typeof(TOther) == typeof(uint))
815 result = (uint)(
object)
value;
818 if (typeof(TOther) == typeof(ulong))
820 result = (ulong)(
object)
value;
823 if (typeof(TOther) == typeof(
UIntPtr))
833 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
836 return TryParse(
s, style, provider, out result);
839 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
842 return TryParse(
s, style, provider, out result);
845 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
848 return Parse(
s, provider);
851 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
857 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
860 return value << shiftAmount;
863 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
866 return value >> shiftAmount;
869 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
875 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
881 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
887 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
893 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal ToDecimal(object? value)
static long ToInt64(object? value)
static float ToSingle(object? value)
static int ToInt32(object? value)
static short ToInt16(object? value)
static byte ToByte(object? value)
static uint ToUInt32(object? value)
static char ToChar(object? value)
static ushort ToUInt16(object? value)
static sbyte ToSByte(object? value)
static double ToDouble(object? value)
static bool ToBoolean([NotNullWhen(true)] object? value)
static object DefaultToType(IConvertible value, Type targetType, IFormatProvider provider)
static byte Clamp(byte value, byte min, byte max)
static byte Min(byte val1, byte val2)
static int DivRem(int a, int b, out int result)
static byte Max(byte val1, byte val2)
static unsafe string UInt64ToDecStr(ulong value, int digits)
static bool TryFormatUInt64(ulong value, ReadOnlySpan< char > format, IFormatProvider provider, Span< char > destination, out int charsWritten)
static ParsingStatus TryParseUInt64(ReadOnlySpan< char > value, NumberStyles styles, NumberFormatInfo info, out ulong result)
static ParsingStatus TryParseUInt64IntegerStyle(ReadOnlySpan< char > value, NumberStyles styles, NumberFormatInfo info, out ulong result)
static ulong ParseUInt64(ReadOnlySpan< char > value, NumberStyles styles, NumberFormatInfo info)
static string FormatUInt64(ulong value, string format, IFormatProvider provider)
static int TrailingZeroCount(int value)
static bool IsPow2(int value)
static int PopCount(uint value)
static int Log2(uint value)
static uint RotateRight(uint value, int offset)
static int LeadingZeroCount(uint value)
static uint RotateLeft(uint value, int offset)
static string Arg_MustBeUInt64
static string InvalidCast_FromTo
static string Format(string resourceFormat, object p1)
static void ThrowNotSupportedException(ExceptionResource resource)
static void ThrowArgumentNullException(string name)
static TResult AdditiveIdentity
static TSelf RotateRight(TSelf value, int rotateAmount)
static TSelf LeadingZeroCount(TSelf value)
static TSelf PopCount(TSelf value)
static TSelf TrailingZeroCount(TSelf value)
static TSelf RotateLeft(TSelf value, int rotateAmount)
static bool IsPow2(TSelf value)
static TSelf Log2(TSelf value)
short ToInt16(IFormatProvider? provider)
char ToChar(IFormatProvider? provider)
byte ToByte(IFormatProvider? provider)
decimal ToDecimal(IFormatProvider? provider)
object ToType(Type conversionType, IFormatProvider? provider)
uint ToUInt32(IFormatProvider? provider)
DateTime ToDateTime(IFormatProvider? provider)
int ToInt32(IFormatProvider? provider)
long ToInt64(IFormatProvider? provider)
ushort ToUInt16(IFormatProvider? provider)
double ToDouble(IFormatProvider? provider)
float ToSingle(IFormatProvider? provider)
sbyte ToSByte(IFormatProvider? provider)
ulong ToUInt64(IFormatProvider? provider)
bool ToBoolean(IFormatProvider? provider)
static TResult MultiplicativeIdentity
static TSelf Max(TSelf x, TSelf y)
static bool TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out TSelf result)
static TSelf Parse(string s, NumberStyles style, IFormatProvider? provider)
static TSelf Sign(TSelf value)
static TSelf Min(TSelf x, TSelf y)
static TSelf Abs(TSelf value)
static TSelf Clamp(TSelf value, TSelf min, TSelf max)
static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out TSelf result)
static TSelf Parse(string s, IFormatProvider? provider)
static bool TryParse(ReadOnlySpan< char > s, IFormatProvider? provider, out TSelf result)
static TSelf Parse(ReadOnlySpan< char > s, IFormatProvider? provider)
override bool Equals([NotNullWhen(true)] object? obj)
static ulong Parse(string s, IFormatProvider? provider)
static ulong ulong Remainder INumber< ulong >. DivRem(ulong left, ulong right)
static bool TryParse(ReadOnlySpan< char > s, out ulong result)
static bool TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out ulong result)
static bool TryParse(ReadOnlySpan< char > s, NumberStyles style, IFormatProvider? provider, out ulong result)
string ToString(IFormatProvider? provider)
string ToString(string? format, IFormatProvider? provider)
static ulong Parse(string s)
static bool TryParse([NotNullWhen(true)] string? s, out ulong result)
static ulong Parse(string s, NumberStyles style, IFormatProvider? provider)
static ulong Parse(ReadOnlySpan< char > s, NumberStyles style=NumberStyles.Integer, IFormatProvider? provider=null)
override string ToString()
int CompareTo(object? value)
override int GetHashCode()
string ToString(string? format)
bool TryFormat(Span< char > destination, out int charsWritten, ReadOnlySpan< char > format=default(ReadOnlySpan< char >), IFormatProvider? provider=null)
static ulong Parse(string s, NumberStyles style)
int CompareTo(ulong value)