C# How to format a double to one decimal place without rounding

后端 未结 6 1387

I need to format a double value to one decimal place without it rounding.

double value = 3.984568438706
string result = \"\";

What I have tried

6条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-18 16:09

    ( Math.Truncate( ( value * 10 ) ) / 1000 ).ToString( "#.#%" )
    

提交回复
热议问题