2010-02-12 7 views

Répondre

-1

Notez que arrondit:

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

// Output: 1.2345 

En tant que chaîne de format, ce serait:

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

Personnellement, je préfère cette approche.

floatNum.ToString("N4") 
Questions connexes