Permalink
Cannot retrieve contributors at this time
Fetching contributors…
| // <Snippet3> | |
| using System; | |
| using System.Globalization; | |
| using System.Threading; | |
| public class Example | |
| { | |
| public static void Main() | |
| { | |
| string[] values= { "able", "ångström", "apple", "Æble", | |
| "Windows", "Visual Studio" }; | |
| Array.Sort(values); | |
| DisplayArray(values); | |
| // Change culture to Swedish (Sweden). | |
| string originalCulture = CultureInfo.CurrentCulture.Name; | |
| Thread.CurrentThread.CurrentCulture = new CultureInfo("sv-SE"); | |
| Array.Sort(values); | |
| DisplayArray(values); | |
| // Restore the original culture. | |
| Thread.CurrentThread.CurrentCulture = new CultureInfo(originalCulture); | |
| } | |
| private static void DisplayArray(string[] values) | |
| { | |
| Console.WriteLine("Sorting using the {0} culture:", | |
| CultureInfo.CurrentCulture.Name); | |
| foreach (string value in values) | |
| Console.WriteLine(" {0}", value); | |
| Console.WriteLine(); | |
| } | |
| } | |
| // The example displays the following output: | |
| // Sorting using the en-US culture: | |
| // able | |
| // Æble | |
| // ångström | |
| // apple | |
| // Visual Studio | |
| // Windows | |
| // | |
| // Sorting using the sv-SE culture: | |
| // able | |
| // Æble | |
| // apple | |
| // Windows | |
| // Visual Studio | |
| // ångström | |
| // </Snippet3> |