Faster alternative to Convert.ToDouble(string)

前端 未结 7 2302
陌清茗
陌清茗 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:20

    Function in this post Faster alternative to decimal.Parse is based on Jeffrey Sax's code. It adds support for negative numbers, optimizes performance by caching input.Length into a variable and works also for larger numbers.

提交回复
热议问题