With .NET 4.5, we have in our hands a way of specifying the default culture for all of our application threads in a quick and efficient way.
We will now define the default culture for our application domain as follows:
caCultureAppDomain
.using
clause for globalization:using System.Globalization;
static void DefineAppDomainCulture() { String CultureString = "en-US"; DisplayCulture(); CultureInfo.DefaultThreadCurrentCulture = CultureInfo.CreateSpecificCulture(CultureString); CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.CreateSpecificCulture(CultureString); DisplayCulture(); Console.ReadLine(); } static void DisplayCulture() { Console.WriteLine("App Domain........: {0}", AppDomain.CurrentDomain.Id); Console.WriteLine("Default Culture...: {0}", CultureInfo.DefaultThreadCurrentCulture); Console.WriteLine("Default UI Culture: {0}", CultureInfo.DefaultThreadCurrentUICulture); }
DefineAppDomainCulture()
method.