How to CultureInfo in C#

The CultureInfo class holds culture-specific information, such as the associated language, sublanguage, country/region, calendar, and cultural conventions. This class also provides access to culture-specific instances of DateTimeFormatInfo, NumberFormatInfo, CompareInfo, and TextInfo.

Culture information sample:

E.g. CULTURE - en-GB ENGLISH NAME - English (United Kingdom)

The cultures are generally grouped into three sets: the invariant culture, the neutral cultures, and the specific cultures. The cultures have a hierarchy, such that the parent of a specific culture is a neutral culture and the parent of a neutral culture is the InvariantCulture. The Parent property returns the neutral culture associated with a specific culture. If the resources for the specific culture are not available in the system, the resources for the neutral culture are used; if the resources for the neutral culture are not available, the resources embedded in the main assembly are used.

The culture is a property of the executing thread. This read-only property returns Thread.CurrentCulture. You can find the current culture information from.

Thread.CurrentThread.CurrentCulture.Name

The following C# program shows how to get all culture names in the .NET Framework. To use CultureInfo class you need to include System.Globalization namespace in your project.

Full Source C#
using System; using System.Threading; using System.Globalization; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { //MessageBox.Show(Thread.CurrentThread.CurrentCulture.Name); foreach (CultureInfo ci in CultureInfo.GetCultures(CultureTypes.AllCultures)) { MessageBox.Show(ci.EnglishName+ " - " + ci.Name); } } } }