Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/320.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 无法获取Math.Abs的值(-2147483648)_C# - Fatal编程技术网

C# 无法获取Math.Abs的值(-2147483648)

C# 无法获取Math.Abs的值(-2147483648),c#,C#,这是我的密码 string strTemp = ""; for (int i = input1; i <= input2; i++) { strTemp = Math.Abs(i).ToString(); //other stuff here } 字符串strTemp=”“; for(int i=input1;i+2147483648大于int的最大值,即231-1。 相反,您可以使用long;它的最大值是263-1 如果这还不够,请使用biginger+21474836

这是我的密码

string strTemp = "";
for (int i = input1; i <= input2; i++)
{
    strTemp = Math.Abs(i).ToString();
    //other stuff here
}
字符串strTemp=”“;

for(int i=input1;i
+2147483648
大于
int
的最大值,即231-1。
相反,您可以使用
long
;它的最大值是263-1


如果这还不够,请使用
biginger
+2147483648
大于
int
的最大值,即231-1。
相反,您可以使用
long
;它的最大值是263-1


如果这还不够,请使用
biginger

那么你的意思是我必须像
Math.Abs((long)I)一样将int转换为long。ToString()
@SLaks input1和input2始终是int,并在函数中提供。实际上,我一直在语法上纠结于如何编写?那么你的意思是我必须像
Math.Abs((long)I)一样将int转换为long
@SLaks input1和input2始终为int,并在函数中提供。实际上,我对语法感到困惑,无法理解如何编写?