Exemplo n.º 1
0
 /// <summary>
 /// Asserts whether a currency is compatible with this exchange rate, that is, is the same as <see cref="From"/>.
 /// </summary>
 /// <param name="from">The currency to check its compatibility againsts the base currency.</param>
 /// <exception cref="DifferentCurrencyException"><paramref name="from"/> is not compatible.</exception>
 private void assertCompatibility(CurrencyIsoCode from)
 {
     if (from != From)
     {
         throw new DifferentCurrencyException(From.AlphabeticCode(), from.AlphabeticCode());
     }
 }
Exemplo n.º 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");
            }
        }
Exemplo n.º 3
0
 public Currency(CurrencyIsoCode surrogated)
 {
     IsoCode = surrogated.AlphabeticCode();
 }