コード例 #1
0
        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);
        }
コード例 #2
0
 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()));
 }