The "." custom format specifier adds a localized decimal separator into the output string.
The 1st period in the format string determines the location of the decimal separator in the formatted value.
double d = 2.3;
d.ToString("0.00", CultureInfo.InvariantCultureLet us see another example to learn how to implement “.” Custom specifier.
Example
using System;
using System.Globalization;
class Demo {
static void Main() {
double d;
d = 3.7;
Console.WriteLine(d.ToString("0.00", CultureInfo.InvariantCulture));
Console.WriteLine(String.Format(CultureInfo.InvariantCulture, "{0:0.00}", d));
d = 5.89;
Console.WriteLine(d.ToString("00.00", CultureInfo.InvariantCulture));
Console.WriteLine(String.Format(CultureInfo.InvariantCulture, "{0:00.00}", d));
}
}Output
3.70 3.70 05.89 05.89