Created
June 12, 2022 08:21
-
-
Save yohey03518/09d908b83639ebce22eaf3b61a77ac5b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float num_float = 12345.0000f; | |
double num_double = 12345.0000; | |
decimal num_decimal = 12345.0000m; | |
Console.WriteLine("Current Culture (default) : " + Thread.CurrentThread.CurrentCulture.Name); | |
Console.WriteLine("num_float.ToString(\"F2\"): " + num_float.ToString("F2")); | |
Console.WriteLine("num_double.ToString(\"F2\"): " + num_double.ToString("F2")); | |
Console.WriteLine("num_decimal.ToString(\"F2\"): " + num_decimal.ToString("F2")); | |
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US"); | |
Console.WriteLine("Current Culture: " + Thread.CurrentThread.CurrentCulture.Name); | |
Console.WriteLine("num_float.ToString(\"F2\"): " + num_float.ToString("F2")); | |
Console.WriteLine("num_double.ToString(\"F2\"): " + num_double.ToString("F2")); | |
Console.WriteLine("num_decimal.ToString(\"F2\"): " + num_decimal.ToString("F2")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment