Search code examples
c#multithreading

Set default thread culture for all thread?


I want to set a default culture for every thread that I open in my application. Is there a way to set it (without setting it on every thread individually)


Solution

  • if you are using .net 4.5 you can use the below property

    CultureInfo.DefaultThreadCurrentCulture Property

    In the .NET Framework 4 and previous versions, by default, the culture of all threads is set to the Windows system culture. For applications whose current culture differs from the default system culture, this behavior is often undesirable. In the .NET Framework 4.5, the DefaultThreadCurrentCulture property enables an application to define the default culture of all threads in an application domain.

    http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.defaultthreadcurrentculture.aspx