展开全部
double s=0.55555;
result=s.ToString("#0.00");//点后面几个0就保留几位
如果要四舍五入62616964757a686964616fe59b9ee7ad9431333365633938的话,用这个
double dbdata = 0.55555;
string str1 = dbdata.ToString("f2");//fN 保留N位,四舍五入
具体说明见下: 1 string str0 = i.ToString("f"); //25.00 2 string str1 = i.ToString("f1"); //25.0 3 string str2 = i.ToString("f2"); //25.00 4 string str3 = i.ToString("f3"); //25.000 5 string str4 = i.ToString("f4"); //25.0000 其他方式的如下: 1 int i = 111125; 2 string str0 = i.ToString("n"); //111,125.00 3 string str1 = i.ToString("n1"); //111,125.0 4 string str2 = i.ToString("n2"); //111,125.00 5 string str3 = i.ToString("n3"); //111,125.000 6 string str4 = i.ToString("n4"); //111,125.0000