public static CurrencyCode Convert(this ECurrencyCode eCurrencyCode) { var value = eCurrencyCode.ToString(); if (Enum.TryParse <CurrencyCode>(value, out var result)) { return(result); } throw new ArgumentOutOfRangeException(nameof(eCurrencyCode), eCurrencyCode, null); }
public static CultureInfo?GetCultureInfo(this ECurrencyCode eCurrencyCode) { if (eCurrencyCode == ECurrencyCode.Invalid) { return(null); } return(CultureInfo.GetCultures(CultureTypes.SpecificCultures) .FirstOrDefault(culture => new RegionInfo(culture.LCID).ISOCurrencySymbol == eCurrencyCode.ToString())); }