Get CultureInfo from currency code?

I need to get System.Globalization.CultureInfo for different currency codes.

Examples: EUR, GBP, USD

I am currently doing the following inside a switch statement based on this three-letter currency code, obviously this is not a way to do this:

var ci = new System.Globalization.CultureInfo("en-US"); 

Does anyone have a clean way to achieve the same results using the currency code instead?

+7
source share
3 answers

Short: This is impossible. For example, the euro will be displayed in de-DE, fr-FR, nl-NL and other countries. There is no mapping from currency to culture, as several countries use currency.

+12
source
 static IEnumerable<CultureInfo> GetCultureInfosByCurrencySymbol(string currencySymbol) { if (currencySymbol == null) { throw new ArgumentNullException("currencySymbol"); } return CultureInfo.GetCultures(CultureTypes.SpecificCultures) .Where(x => new RegionInfo(x.LCID).ISOCurrencySymbol == currencySymbol); } 

for example

 foreach (var culture in GetCultureInfosByCurrencySymbol("GBP")) { Console.WriteLine(culture.Name); } 

prints:

 cy-GB gd-GB en-GB 
+16
source

I believe what you are looking for

 var region = new System.Globalization.RegionInfo.CurrentRegion(); 

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

0
source

All Articles