Use NumberFormatInfo to format a number : NumberFormatInfo « Internationalization I18N « C# / C Sharp






Use NumberFormatInfo to format a number

 


using System;
using System.Globalization;
public class MainClass {
    public static void Main() {

        NumberFormatInfo f = new NumberFormatInfo();
        f.CurrencySymbol = "$$";
        Console.WriteLine(3.ToString("C", f));          // $$ 3.00

    }
}
         
  








Related examples in the same category

1.Set NumberGroupSeparator
2.NumberFormatInfo.CurrencyDecimalSeparator gets or sets the string to use as the decimal separator in currency values.
3.NumberFormatInfo.CurrencyDecimalDigits indicates the number of decimal places to use in currency values.