Skip to content

Instantly share code, notes, and snippets.

@ashour
Last active April 24, 2020 13:42
Show Gist options
  • Save ashour/ee0ea47b36b49dcf239660ce66c1bab1 to your computer and use it in GitHub Desktop.
Save ashour/ee0ea47b36b49dcf239660ce66c1bab1 to your computer and use it in GitHub Desktop.
using System;
using System.Threading;
using System.Globalization;
class MainClass
{
public static void Main (string[] args)
{
// Will print the current culture, which
// depends on your system settings
Console.WriteLine(Thread.CurrentThread.CurrentCulture);
// Will print the current UI culture, which
// depends on your system settings
Console.WriteLine(Thread.CurrentThread.CurrentUICulture);
var french = new CultureInfo("fr");
Thread.CurrentThread.CurrentCulture = french;
Thread.CurrentThread.CurrentUICulture = french;
// Will print "fr"
Console.WriteLine(Thread.CurrentThread.CurrentCulture);
// Will print "fr"
Console.WriteLine(Thread.CurrentThread.CurrentUICulture);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment