C#

Format a String as Currency in C#

When building a string for output to a web page, it’s useful to format any currency value in a human-friendly money format. This is extremely easy in C#.

The system format string works like this: {0:n0}

For example, the following code example:

double value = 1000;

string.Format(“{0:n0}”,value);

Output:

1,000

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.