Mega Code Archive

 
Categories / C# / Internationalization
 

Illustrates the current cultures

/* Mastering Visual C# .NET by Jason Price, Mike Gunderloy Publisher: Sybex; ISBN: 0782129110 */ /*   Example21_8.cs illustrates the current cultures */ using System; using System.Globalization; using System.Threading; public class Example21_8  {   public static void Main()    {     // set the current culture for the executing thread     Thread.CurrentThread.CurrentCulture=new CultureInfo("de-DE");     // and display it     Console.WriteLine(Thread.CurrentThread.CurrentCulture.Name);     // create another new culture     CultureInfo ci = new CultureInfo("en-US");     // prove that this doesn't change the current culture     Console.WriteLine(CultureInfo.CurrentCulture.Name);     // set the current UI culture for the executing thread     Thread.CurrentThread.CurrentUICulture=new CultureInfo("fr-FR");     // and display it     Console.WriteLine(Thread.CurrentThread.CurrentUICulture.Name);     // create another new culture     CultureInfo ci2 = new CultureInfo("en-US");     // prove that this doesn't change the current culture     Console.WriteLine(CultureInfo.CurrentUICulture.Name);   } }