gpt4 book ai didi

c# - 格式异常 : Could not find any recognizable digits

转载 作者:太空狗 更新时间:2023-10-30 00:50:04 24 4
gpt4 key购买 nike

我得到这个异常:

A first chance exception of type 'System.FormatException' occurred in mscorlib.dll

在这一行:

String value = "2";
uint? test = Convert.ToUInt32(value, 2);

最佳答案

那是因为你的第二个参数将基数设置为 2,而 2 不是二进制的有效数字。

来自 MSDN

The call to public static uint ToUInt32(string value, int fromBase) will throw a FormatException when value contains a character that is not a valid digit in the base specified by fromBase. The exception message indicates that there are no digits to convert if the first character in value is invalid; otherwise, the message indicates that value contains invalid trailing characters.

关于c# - 格式异常 : Could not find any recognizable digits,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34059155/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com