TSCurrencyConverter Class

Constructors

  Name Description
TSCurrencyConverter() Initializes new instance of the TSCurrencyConverter class

TSCurrencyConverter Methods

  Name Description
string[] GetCurrencyTags() returns an array with 3 letter currency tags
Currency GetCurrencyData(string currencyTag) Get currency data and default exchange rate in euro's by using tag(s) from GetAvailableCurrencyTags()
float GetExchangeRate(Currency from, Currency to, float multiplier) Gets the exchange rate between 2 currencies

TSCurrencyConverter Code Example


  // create & initialize TSCurrencyConverter instance
  TSCurrencyConverter currencyConverter = new TSCurrencyConverter();

  // initialize financial currencies
  Currency euro = currencyConverter.GetCurrencyData("eur");
  Currency dollar = currencyConverter.GetCurrencyData("usd");

  // gets the exchange rate "from 1 Euro to American Dollar"
  float exchangeEuroToDollar = currencyConverter.GetExchangeRate(euro, dollar, 1);
  // gets the exchange rate "from 1 American Dollar to Euro"
  float exchangeDollarToEuro = currencyConverter.GetExchangeRate(dollar, euro, 1);
  // gets the exchange rate "from 5 Dollar to Euro"
  float exchangeFiveDollarToEuro = currencyConverter.GetExchangeRate(dollar, euro, 5);