/// <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()); } }
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"); } }
public Currency(CurrencyIsoCode surrogated) { IsoCode = surrogated.AlphabeticCode(); }