string retval;
retval = Decimal.ToInt32(1899.99M).ToString();
输出是 1899。但我想如果小数大于 .5,则输出为 1900,否则输出为 1899。我该怎么做?提前致谢!
最佳答案
首先使用 Math.Round。
http://msdn.microsoft.com/en-us/library/system.math.round.aspx
关于c# - 将小数转换为整数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4725396/