How to set CultureInfo.CurrentCulture?

user2740190 picture user2740190 · Jan 23, 2014 · Viewed 21k times · Source

Using:

Console.WriteLine(System.Globalization.CultureInfo.CurrentCulture.ToString());

I get "en-US".

What should I change in my control panel settings ( Region and Language ? ) to get something else for example "en-CA" .

Answer

Habib picture Habib · Jan 23, 2014

What should I change in my control panel settings ( Region and Language ? ) to get something else for example "en-CA" .

You can change it for current thread like:

System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("en-CA");

and then:

Console.WriteLine(System.Globalization.CultureInfo.CurrentCulture.ToString());

would return:

en-CA