<分区>
Possible Duplicate:
C# int.parse issue with leading zeros
我如何将其更正为带有前导零的 int。实际上需要忽略/删除 FormatException。
string value = "055";
int x = int.Parse(value);
<分区>
Possible Duplicate:
C# int.parse issue with leading zeros
我如何将其更正为带有前导零的 int。实际上需要忽略/删除 FormatException。
string value = "055";
int x = int.Parse(value);
最佳答案
它在我的系统上运行良好。
可能是当前文化的问题,你可以试试
string value = "055";
int x = int.Parse(value, CultureInfo.InvariantCulture);
关于c# - C# 中的 Int.Parse 抛出格式异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11877688/