C#中,为什么浮点数tostring有时候会丢失0?怎么用固定表示法?

C#中,为什么浮点数tostring有时候会丢失0?怎么用固定表示法?

什么叫丢失0?你可以用tostring("#.0000")加上一个格式。

这个是填充格式,你可以用format等来指定
http://blog.csdn.net/wem520/article/details/7474106

这个是填充格式,
http://blog.csdn.net/wem520/article/details/7474106

tostring("f2')//保留两位小数,自动四舍五入,fn 保留n位小数