【发布时间】:2013-12-17 16:32:42
【问题描述】:
这个问题的后续: C# how to always round down to nearest 50
如何将小数四舍五入到最接近的 50 并返回一个 int,我可以执行以下操作但必须有更有效的解决方案?
decimal test = 154.45m;
decimal newValue = Math.Floor(test / 50m) * 50.0m;
int testInt = Convert.ToInt32(newValue);
【问题讨论】:
标签: c#