110,533
社区成员
发帖
与我相关
我的任务
分享
Console.WriteLine(Math.Round(1.041, 1));
显示的是1……
这不是decimal类型Math.Round(1.20,1)
decimal d = 0.0000m;
string s = d.ToString();
if (s.IndexOf(".") > 0)
s = s.TrimEnd('0').TrimEnd('.');
decimal d = 1.0000m;
string s = d.ToString();
if (s.IndexOf(".") > 0)
s = s.Trim('0').Trim('.');