Convert “1.79769313486232E+308” to double without OverflowException?

后端 未结 8 1332
暗喜
暗喜 2020-12-07 01:20

I have this string \"1.79769313486232E+308\" and am trying to convert it to a .NET numeric value (double?) but am getting the below exception. I am using Convert.ToDo

8条回答
  •  臣服心动
    2020-12-07 01:38

    I get the same number at times. Here's how I addressed it.

    var str = "1.79769313486232E+308"; var dbl = double.Parse(str.Replace("E+", ""));

提交回复
热议问题