private IsoCurrency loadIsoCurrency(FileInfo file, CurrencyIsoCode currency)
        {
            var loader     = new IsoCurrenciesLoader();
            var collection = file?.Exists ?? false?
                             loader.LoadFrom(file.OpenRead()) :
                                 loader.LoadFrom(IsoCurrenciesLoader.IsoUrl);

            short currencyCode = currency.NumericCode();

            return(collection.Single(c => c.NumericCode.Value.GetValueOrDefault() == currencyCode));
        }
Exemple #2
0
        internal static void WriteValue(this JsonWriter writer, CurrencyIsoCode currency, CurrencyStyle style)
        {
            switch (style)
            {
            case CurrencyStyle.Alphabetic:
                writer.WriteValue(currency.AlphabeticCode());
                break;

            case CurrencyStyle.Numeric:
                writer.WriteValue(currency.NumericCode());
                break;

            default:
                throw new ArgumentOutOfRangeException("style");
            }
        }
 /// <summary>
 /// Returns a padded three digit string representation of the <see cref="NumericCode"/>.
 /// </summary>
 public static string PaddedNumericCode(this CurrencyIsoCode isoCode)
 {
     return(isoCode.NumericCode().ToString("000", CultureInfo.InvariantCulture));
 }
 /// <summary>
 /// Returns a combination of the ISO 4217 code and its numeric value, separated by the equals sign '<code>=</code>'.
 /// </summary>
 public static string AsValuePair(this CurrencyIsoCode isoCode)
 {
     return(isoCode + EQUAL + isoCode.NumericCode());
 }