Formatting currency

Found a rather nifty trick for formatting double values into currency strings. It’s really simple! You just specify “C” as an argument to the ToString method and it automatically generates a currency string that’s in the right format for whatever your local settings are.

value.ToString("C");

There’s lots of other stuff you can do with the ToString method.

Posted on 25 Jan 05 by Helen Emerson (last updated on 25 Jan 05).
Filed under .NET