2010-02-12 54 views

回答

-1

注意,便將:

decimal d = 1.23456789M; 
Console.WriteLine(d.ToString("0.0000")); 

// Output: 1.2345 

作爲格式字符串,這將是:

Console.WriteLine("{0:0.0000}", d); 
0

就個人而言,我更喜歡這種方法。

floatNum.ToString("N4")