The initial settings for a NumberFormatInfo or DateTimeFormatInfo are based on the invariant culture.
The following code creates a NumberFormatInfo and change the group separator from a comma to a space, then use it to format a number to three decimal places:
using System;
using System.Text;
using System.Globalization;
class Sample
{
public static void Main()
{
NumberFormatInfo f = new NumberFormatInfo();
f.NumberGroupSeparator = " ";
Console.WriteLine(12345.6789.ToString("N3", f));
}
}
The output:
12 345.679