Numeric objects also provide various kinds of formatting options to
specify the number of decimal places:
float x = 12.341514325f;
string s =x.ToString ("###.###"); //gives 12.342
specify the number of decimal places:
float x = 12.341514325f;
string s =x.ToString ("###.###"); //gives 12.342
博客展示了数值对象的格式化选项,以浮点数为例,通过ToString方法指定小数位数进行格式化。如将浮点数12.341514325f按###.###格式处理后得到12.342。
2782

被折叠的 条评论
为什么被折叠?



