用C#如何格式化小数,比如:12.9032 格式化后为:12.903
计算用 Math.Round() :
Math.Round(12.9032,3)
显示用 toString():
double MyDouble = 12.9032; MyDouble.ToString( "#0.000 ");
decimal number = 12.9032m; Console.WriteLine(number.ToString("N3"));