10[TypeForwardedFrom(
"mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
11public readonly
struct Int32 :
IComparable,
IConvertible,
ISpanFormattable,
IFormattable,
IComparable<int>,
IEquatable<int>,
IBinaryInteger<int>,
IBinaryNumber<int>,
IBitwiseOperators<int, int, int>,
INumber<int>,
IAdditionOperators<int, int, int>,
IAdditiveIdentity<int, int>,
IComparisonOperators<int, int>,
IEqualityOperators<int, int>,
IDecrementOperators<int>,
IDivisionOperators<int, int, int>,
IIncrementOperators<int>,
IModulusOperators<int, int, int>,
IMultiplicativeIdentity<int, int>,
IMultiplyOperators<int, int, int>,
ISpanParseable<int>,
IParseable<int>,
ISubtractionOperators<int, int, int>,
IUnaryNegationOperators<int, int>,
IUnaryPlusOperators<int, int>,
IShiftOperators<int, int>,
IMinMaxValue<int>,
ISignedNumber<int>
19 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
22 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
25 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
28 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
31 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
34 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
37 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
74 public override bool Equals([NotNullWhen(
true)]
object?
obj)
80 return this == (int)
obj;
163 public static bool TryParse([NotNullWhen(
true)]
string?
s, out
int result)
275 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
281 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
287 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
293 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
299 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
305 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
311 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
317 [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")]
357 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
360 return left <= right;
363 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
369 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
372 return left >= right;
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")]
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")]
396 return left != right;
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")]
423 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
429 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
432 if (typeof(TOther) == typeof(
byte))
434 return (
byte)(object)
value;
436 if (typeof(TOther) == typeof(
char))
438 return (
char)(object)
value;
440 if (typeof(TOther) == typeof(decimal))
442 return (
int)(decimal)(
object)
value;
446 if (typeof(TOther) == typeof(
double))
448 return (
int)(double)(
object)
value;
450 if (typeof(TOther) == typeof(
short))
452 return (
short)(object)
value;
454 if (typeof(TOther) == typeof(
int))
456 return (
int)(object)
value;
458 if (typeof(TOther) == typeof(
long))
460 return (
int)(long)(
object)
value;
462 if (typeof(TOther) == typeof(
IntPtr))
466 if (typeof(TOther) == typeof(sbyte))
468 return (sbyte)(object)
value;
470 if (typeof(TOther) == typeof(
float))
472 return (
int)(float)(
object)
value;
474 if (typeof(TOther) == typeof(ushort))
476 return (ushort)(object)
value;
478 if (typeof(TOther) == typeof(uint))
480 return (
int)(uint)(
object)
value;
482 if (typeof(TOther) == typeof(ulong))
484 return (
int)(ulong)(
object)
value;
486 if (typeof(TOther) == typeof(
UIntPtr))
496 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
499 return Create(
value);
503 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
506 if (typeof(TOther) == typeof(
byte))
508 return (
byte)(object)
value;
510 if (typeof(TOther) == typeof(
char))
512 return (
char)(object)
value;
514 if (typeof(TOther) == typeof(decimal))
516 decimal num = (decimal)(
object)
value;
517 if (!(num > 2147483647m))
519 if (!(num < -2147483648m))
527 if (typeof(TOther) == typeof(
double))
529 double num2 = (double)(
object)
value;
530 if (!(num2 > 2147483647.0))
532 if (!(num2 < -2147483648.0))
540 if (typeof(TOther) == typeof(
short))
542 return (
short)(object)
value;
544 if (typeof(TOther) == typeof(
int))
546 return (
int)(object)
value;
548 if (typeof(TOther) == typeof(
long))
550 long num3 = (long)(
object)
value;
561 if (typeof(TOther) == typeof(
IntPtr))
568 return (
int)(nint)intPtr;
574 if (typeof(TOther) == typeof(sbyte))
576 return (sbyte)(object)
value;
578 if (typeof(TOther) == typeof(
float))
580 float num4 = (float)(
object)
value;
581 if (!(num4 > 2.1474836
E+09f))
583 if (!(num4 < -2.1474836
E+09f))
591 if (typeof(TOther) == typeof(ushort))
593 return (ushort)(object)
value;
595 if (typeof(TOther) == typeof(uint))
597 uint num5 = (uint)(
object)
value;
604 if (typeof(TOther) == typeof(ulong))
606 ulong num6 = (ulong)(
object)
value;
613 if (typeof(TOther) == typeof(
UIntPtr))
618 return (
int)(nuint)uIntPtr;
627 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
630 if (typeof(TOther) == typeof(
byte))
632 return (
byte)(object)
value;
634 if (typeof(TOther) == typeof(
char))
636 return (
char)(object)
value;
638 if (typeof(TOther) == typeof(decimal))
640 return (
int)(decimal)(
object)
value;
642 if (typeof(TOther) == typeof(
double))
644 return (
int)(double)(
object)
value;
646 if (typeof(TOther) == typeof(
short))
648 return (
short)(object)
value;
650 if (typeof(TOther) == typeof(
int))
652 return (
int)(object)
value;
654 if (typeof(TOther) == typeof(
long))
656 return (
int)(long)(
object)
value;
658 if (typeof(TOther) == typeof(
IntPtr))
662 if (typeof(TOther) == typeof(sbyte))
664 return (sbyte)(object)
value;
666 if (typeof(TOther) == typeof(
float))
668 return (
int)(float)(
object)
value;
670 if (typeof(TOther) == typeof(ushort))
672 return (ushort)(object)
value;
674 if (typeof(TOther) == typeof(uint))
676 return (
int)(uint)(
object)
value;
678 if (typeof(TOther) == typeof(ulong))
680 return (
int)(ulong)(
object)
value;
682 if (typeof(TOther) == typeof(
UIntPtr))
690 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
696 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
702 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
708 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
711 return Parse(
s, style, provider);
714 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
717 return Parse(
s, style, provider);
720 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
727 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
730 if (typeof(TOther) == typeof(
byte))
732 result = (byte)(
object)
value;
735 if (typeof(TOther) == typeof(
char))
737 result = (char)(
object)
value;
740 if (typeof(TOther) == typeof(decimal))
742 decimal num = (decimal)(
object)
value;
743 if (num < -2147483648m || num > 2147483647m)
751 if (typeof(TOther) == typeof(
double))
753 double num2 = (double)(
object)
value;
754 if (num2 < -2147483648.0 || num2 > 2147483647.0)
762 if (typeof(TOther) == typeof(
short))
767 if (typeof(TOther) == typeof(
int))
769 result = (int)(
object)
value;
772 if (typeof(TOther) == typeof(
long))
774 long num3 = (long)(
object)
value;
775 if (num3 < int.MinValue || num3 >
int.
MaxValue)
783 if (typeof(TOther) == typeof(
IntPtr))
786 if ((nint)intPtr < int.MinValue || (nint)intPtr >
int.
MaxValue)
791 result = (int)(nint)intPtr;
794 if (typeof(TOther) == typeof(sbyte))
796 result = (sbyte)(
object)
value;
799 if (typeof(TOther) == typeof(
float))
801 float num4 = (float)(
object)
value;
802 if (num4 < -2.1474836E+09f || num4 > 2.1474836
E+09f)
810 if (typeof(TOther) == typeof(ushort))
812 result = (ushort)(
object)
value;
815 if (typeof(TOther) == typeof(uint))
817 uint num5 = (uint)(
object)
value;
826 if (typeof(TOther) == typeof(ulong))
828 ulong num6 = (ulong)(
object)
value;
837 if (typeof(TOther) == typeof(
UIntPtr))
845 result = (int)(nuint)uIntPtr;
853 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
856 return TryParse(
s, style, provider, out result);
859 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
862 return TryParse(
s, style, provider, out result);
865 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
868 return Parse(
s, provider);
871 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
877 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
880 return value << shiftAmount;
883 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
886 return value >> shiftAmount;
889 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
895 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
901 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
907 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
913 [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 short ToInt16(object? value)
static byte ToByte(object? value)
static uint ToUInt32(object? value)
static ulong ToUInt64(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 double Abs(double value)
static int DivRem(int a, int b, out int result)
static int Sign(decimal value)
static byte Max(byte val1, byte val2)
static int ParseInt32(ReadOnlySpan< char > value, NumberStyles styles, NumberFormatInfo info)
static ParsingStatus TryParseInt32IntegerStyle(ReadOnlySpan< char > value, NumberStyles styles, NumberFormatInfo info, out int result)
static string FormatInt32(int value, int hexMask, string format, IFormatProvider provider)
static string Int32ToDecStr(int value)
static ParsingStatus TryParseInt32(ReadOnlySpan< char > value, NumberStyles styles, NumberFormatInfo info, out int result)
static bool TryFormatInt32(int value, int hexMask, ReadOnlySpan< char > format, IFormatProvider provider, Span< char > destination, out int charsWritten)
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 InvalidCast_FromTo
static string Format(string resourceFormat, object p1)
static string Arg_MustBeInt32
static void ThrowNotSupportedException(ExceptionResource resource)
static void ThrowValueArgumentOutOfRange_NeedNonNegNumException()
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)
static bool TryParse([NotNullWhen(true)] string? s, out int result)
override string ToString()
string ToString(string? format)
static int int Remainder INumber< int >. DivRem(int left, int right)
static int Parse(string s)
string ToString(string? format, IFormatProvider? provider)
static int Parse(ReadOnlySpan< char > s, NumberStyles style=NumberStyles.Integer, IFormatProvider? provider=null)
static bool TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out int result)
bool TryFormat(Span< char > destination, out int charsWritten, ReadOnlySpan< char > format=default(ReadOnlySpan< char >), IFormatProvider? provider=null)
static bool TryParse(ReadOnlySpan< char > s, NumberStyles style, IFormatProvider? provider, out int result)
int CompareTo(object? value)
static int Parse(string s, NumberStyles style, IFormatProvider? provider)
string ToString(IFormatProvider? provider)
static bool TryParse(ReadOnlySpan< char > s, out int result)
override bool Equals([NotNullWhen(true)] object? obj)
override int GetHashCode()
static int Parse(string s, NumberStyles style)
static int Create< TOther >(TOther value)
static int Parse(string s, IFormatProvider? provider)