How to get all Culture information using C#

No.of Views2020
Bookmarked0 times
Downloads 
Votes0
By  Prabu   On  11 Jul 2010 01:07:51
Tag : CSharp , General
The CultureInfo class will provide us all Culture information available in .Net Framework. You can use CultureInfo.Get Cultures static method for getting all the culture information.
emailbookmarkadd commentsprint

Images in this article missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at info@codegain.com

 

Introduction

The CultureInfo class will provide us all Culture information available in .Net Framework.  You can use CultureInfo.Get Cultures static method for getting all the culture information. To get associated specific culture, please use static method CultureInfo.CreateSpecificCulture.

The following example will show you how to get all culture information.

CodeSnippet

static void Main(string[] args)
{// Get culture namesList<string> list = new List<string>();foreach (CultureInfo ci in CultureInfo.GetCultures(CultureTypes.AllCultures))
     {string specName = "(none)";try { specName = CultureInfo.CreateSpecificCulture(ci.Name).Name;}catch(Exception) { }

          list.Add(string.Format("{0,-12}{1,-12}{2}", ci.Name, specName, ci.EnglishName));
     }

     list.Sort(); 

     Console.WriteLine("CULTURE  SPEC.CULTURE  ENGLISH NAME");
     Console.WriteLine("----------------------------------------------------");foreach (string str in list)
          Console.WriteLine(str);

     Console.ReadLine();
}

That's all, just copy this code and reuse in your porject. i hope this is save your time.

 
Sign Up to vote for this article
 
About Author
 
Prabu
Occupation-Software Engineer
Company-
Member Type-Fresh
Location-India
Joined date-23 Jun 2010
Home Page-
Blog Page-http://prabu-guru.blogspot.com/
 
 
Other popularSectionarticles
Comments
There is no comments for this articles.
Leave a Reply
Title:
Display Name:
Email:
(not display in page for the security purphase)
Website:
Message:
Please refresh your screen using Ctrl+F5
If you can't read this number refresh your screen
Please input the anti-spam code that you can read in the image.
^ Scroll to Top