Skip to content

Instantly share code, notes, and snippets.

@ashour
Last active March 12, 2020 16:03
Show Gist options
  • Select an option

  • Save ashour/0f5977e129bcdca0132ef457c94da54a to your computer and use it in GitHub Desktop.

Select an option

Save ashour/0f5977e129bcdca0132ef457c94da54a to your computer and use it in GitHub Desktop.
using System;
using System.Globalization;
namespace myApp
{
class Program
{
static void Main()
{
double value = 123456.78d;
IFormatProvider usFormatProvider =
new System.Globalization.CultureInfo("en-US");
Console.WriteLine(value.ToString("#,##0.00", usFormatProvider));
// => 123,456.78 (American format)
IFormatProvider frenchFormatProvider =
new System.Globalization.CultureInfo("fr-FR");
Console.WriteLine(value.ToString("#,##0.00", frenchFormatProvider));
// => 123 456,78 (French format)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment