Get NativeEnglishName from the iso currency symbol, regardless of the current culture of the registered user

that I have currencyIsoCode "EUR". This property can also be found in

RegionInfo class => ri.ISOCurrencySymbol. But the RegionInfo class depends on the currently logged in user.

I want to get NativeEnglishName as "Euro", even if the user is from en-De, en-Us, cn-CN, etc.

How can i do this?

+3
source share
3 answers

, RegionInfo. RegionInfo . :

public static string GetEnglishCurrencyName(string iso) {
  foreach (var c in CultureInfo.GetCultures(CultureTypes.SpecificCultures)) {
    var reg = new RegionInfo(c.LCID);
    if (string.Compare(iso, reg.ISOCurrencySymbol, true) == 0)
      return reg.CurrencyEnglishName;
  }
  throw new ArgumentException();
}

, . , > .

+2

:

string currencyName = CultureInfo.GetCultures(CultureTypes.SpecificCultures)
                   .Where(c => new RegionInfo(c.LCID).ISOCurrencySymbol == "EUR")
                   .Select(c => new RegionInfo(c.LCID).CurrencyEnglishName)
                   .FirstOrDefault();

"".

, RegionInfo, - , , , , , , , , (, , ).

+2

, "CurrencyEnglishName" ISO. RegionInfo, ISOCurrencySymbol = "GBP" " "

ISO - " ".

, - ISO DB ( /, ) .

0

Source: https://habr.com/ru/post/1737513/


All Articles