double dValue = 1880.875;
double d = Math.Round(dValue, 2); //输出:1880.88
decimal de = decimal.Round(decimal.Parse(dValue), 2); //输出:1880.88
double dValue = 612.576;
string str = dValue.ToString("f2"); //输出:612.58
string str1 = dValue.ToString("#0.00"); //输出:612.58,小数点后有几个0就保留几位
double dValue = 201.38769;
string str1 = String.Format("{0:N2}", dValue); //输出:201.39
string str2 = String.Format("{0:N3}", dValue); //输出:201.388
string str3 = String.Format("{0:N4}", dValue); //输出:201.3877
原创文章如转载,请注明出处“
伊人博客”