【发布时间】:2015-02-13 00:34:33
【问题描述】:
我正在尝试将字符串“10.00”转换为十进制,如下所示:
decimal a = Convert.ToDecimal("10.00");
但由于一些令人难以置信的原因,我收到了这个错误:
输入字符串的格式不正确。在 System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) 在 System.Number.ParseDecimal(String value, NumberStyles options, NumberFormatInfo numfmt) 在 System.Convert.ToDecimal(String value) 在 Presentation .Models.OrderBaseModel.Response(FormCollection response, String responseUrl)
还有更深层的原因吗? “10.00”字符串怎么会无法解析??
【问题讨论】:
-
这可能是文化问题 - 您是否尝试解析“10,00”?