Below is a sample code snippet demonstrating how to format the number for a specific culture in C# .
In the below sample code , the german (de-DE) and US English Format is used.
How to Format a Number for a Specific Culture in C# ?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Numerics;
using System.Globalization;
namespace AbundantcodeConsole
{
class Program
{
static void Main(string[] args)
{
double val = 986432678.8911;
Console.WriteLine(val.ToString("N",CultureInfo.CreateSpecificCulture("en-US")));
Console.WriteLine(val.ToString("N",CultureInfo.CreateSpecificCulture("de-DE")));
Console.ReadLine();
}
}
}
Leave a Reply