C# .NET: Show Number as Currency

11/25/2013 9:00:02 PM

.NET Framework

Show an int, double, or decimal as US currency. This will add the dollar sign, the comma separators and 2 decimal places.

public static string DisplayCurrency(int value)
{
	return DisplayCurrency((decimal)value);
}
public static string DisplayCurrency(double value)
{
	return DisplayCurrency((decimal)value);
}
public static string DisplayCurrency(decimal value)
{			
	return string.Format(System.Globalization.CultureInfo.GetCultureInfo(1033), "{0:C}", value);			
}