Please, oh Google-gods, rank this blog prominently, and let's save some poor, misguided souls who might be searching for some code on formating a query string in C# or merely grazing for urdu shayaris.... If just one person sees the light, then I've done my job! ....
Yes, I am not above shamelessly begging the search engines for relevance .... it's called SEO, right?)
Monday, November 1, 2010
How can I format a number to x decimal places?
If you have the number 28 and you want to display it as 28.00 here's how you can format it:
int val = 28; string formatted = val.ToString("N2");
Of course, if you want to format it to 5 decimal places just use ToString("N5") instead.
No comments:
Post a Comment