Reputation: 13508
Help greatly appreciated.
Upvotes: 5
Views: 3090
Reputation: 128317
string formatted = value.ToString("N0");
This divides your number in the manner specified by the current culture (in the case of "en-US," it's a comma per multiple of 1000) and includes no decimal places.
The best place to look for any question regarding formatting numbers in .NET would have to be here:
Standard Numeric Format Strings (MSDN)
And here:
Custom Numeric Format Strings (MSDN)
Upvotes: 5
Reputation: 1437
double x = 10562.3093;
x.ToString("#,0");
or
String.Format("{0:#,0}", 10562.3093);
Upvotes: 0
Reputation: 11214
String.Format("{0:0,0}", 10562.3093);
I keep this website bookmarked for these purposes: String Formatting in C#
Upvotes: 1