In C#, you can create strings as currency. This is done by using the Currency class. The Currency class provides a number of methods that allow you to manipulate the value of a string as currency. The following code example demonstrates how to create a string that is formatted as currency. string str = “€”; // Create a new instance of the Currency class and set its value to € str = new Currency(€); // Format the string using the Currency class’s formatters str = “€0.50”; // Outputs “50 €”


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

For example, the following code example:

Outputs the following:

Order Total: $1,921.39

It’s worth noting that you must pass in a numeric value to the String.Format statement. If you pass in a string value, it won’t format correctly. If your currency value is in a string, you need to convert it into a double first.