http://www.cnblogs.com/wifi/articles/4075915.html
double temp=3.1415926;
(F)Fixed point:string str1=temp.toString("f1");//保留一位小數 四舍五入 結果:3.1
(F)Fixed point:string str2=temp.toString("f2");//保留兩位小數,四舍五入 下面一次類推 結果:3.14
(N)Number:string str2=temp.toString("N");//保留 結果:3.14
(G)General (default):string str2=temp.toString("G");//保留 結果:3.1415926
(P)Percent:string str2=temp.toString("P");//保留 結果:314.16%
(E)Scientific:string str2=temp.toString("E");//保留 結果E:3.141593E+000
(C)Currency:string str2=temp.toString("C");//保留 結果:¥3.14
對於double temp=0.000000926的情況,上述方法都不管用,可以通過轉成decimal格式再顯示。如下所示:
string str = ((decimal)temp).toString();