Why Is ToString() Rounding My Double Value?

前端 未结 5 958
别那么骄傲
别那么骄傲 2020-12-03 17:17

How do I prevent my double value from being rounded when converting to a string? I have tried both Convert.ToString and ToString() with the same r

5条回答
  •  执笔经年
    2020-12-03 17:49

    Jon Skeet's DoubleConverter class has a ToExactString() method which will return the exact value of the double as a string.

    http://www.yoda.arachsys.com/csharp/DoubleConverter.cs

提交回复
热议问题