整数溢出

整数可以存储最大容量。当你超过这个限制时,它将回到负面。对于 int,它是 2147483647

int x = int.MaxValue;                //MaxValue is 2147483647
x = unchecked(x + 1);                //make operation explicitly unchecked so that the example also works when the check for arithmetic overflow/underflow is enabled in the project settings 
Console.WriteLine(x);                //Will print -2147483648
Console.WriteLine(int.MinValue);     //Same as Min value

对于此范围之外的任何整数,使用具有数据类型 BigInteger 的命名空间 System.Numerics。请查看以下链接以获取更多信息 https://msdn.microsoft.com/en-us/library/system.numerics.biginteger(v=vs.110).aspx