using System;
using System.Globalization;
public class Example
{
public static void Main()
{
double number;
number = 12345.6789;
Console.WriteLine(number.ToString("G", CultureInfo.InvariantCulture));
Console.WriteLine(number.ToString("G", CultureInfo.CreateSpecificCulture("fr-FR")));
Console.WriteLine(number.ToString("G7", CultureInfo.InvariantCulture));
number = .0000023;
Console.WriteLine(number.ToString("G", CultureInfo.InvariantCulture));
Console.WriteLine(number.ToString("G", CultureInfo.CreateSpecificCulture("fr-FR")));
number = .0023;
Console.WriteLine(number.ToString("G", CultureInfo.InvariantCulture));
number = 1234;
Console.WriteLine(number.ToString("G2", CultureInfo.InvariantCulture));
number = Math.PI;
Console.WriteLine(number.ToString("G5", CultureInfo.InvariantCulture));
}
}
/*
12345.6789
12345,6789
12345.68
2.3E-06
2,3E-06
0.0023
1.2E+03
3.1416
*/