[英]Input string was not in a correct format on Convert.ToDouble(“Infinity”)
Why would the following fail with a System.FormatException on 64-bit Windows 10, but runs fine on 32-bit Windows 7? 为什么在64位Windows 10上,以下操作失败并出现System.FormatException,但在32位Windows 7上运行正常? Both machines have .NET Framework 4.6.1 installed.
两台机器都安装了.NET Framework 4.6.1。
Convert.ToDouble("Infinity");
I have searched and cannot find an answer to this. 我已经搜索过,但找不到答案。
The string used for Infinity is culture specific and may have even had different values between Win 7 & 10 (can't confirm that at the moment). 用于Infinity的字符串是特定于区域性的,在Win 7和10之间甚至可能具有不同的值(目前无法确认)。
Try using the constant instead of hard coding a string: 尝试使用常量而不是对字符串进行硬编码:
Convert.ToDouble(NumberFormatInfo.PositiveInfinitySymbol);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.