Faster alternative to Convert.ToDouble(string)

前端 未结 7 2304
陌清茗
陌清茗 2020-12-17 23:35

Is there a faster way to convert a string to double than Convert.ToDouble?

I have monitored System.Conv

7条回答
  •  南方客
    南方客 (楼主)
    2020-12-18 00:17

    You can call double.Parse("1.34515"); which is what Convert.ToDouble wraps.

    It may be quicker to call double.TryParse which will avoid the exception overhead.

提交回复
热议问题