c#保留小数点后位数的方法(转)
double dValue = 99.123456;
int iValue = 9999;
string strValue = "99.123456";
string result = "";
result = dValue.ToString("0.00");//99.12
result = Convert.ToDouble(iValue).ToString("0.00");//9999.00
result = Convert.ToDouble(strValue).ToString("0.00"); //99.12
//得到小数点后2位的百分比,自动 加上%号;
result = Convert.ToDouble(dValue).ToString("P"); //9912.34%
//保留小数点后3位;
result = Convert.ToDouble(strValue).ToString("f3"); //99.123
原文:http://www.cnblogs.com/xpvincent/archive/2012/12/26/2834319.html