Toman
(تومن in persian)
Toman provides a way for working with Iranian currencies like Rial and Toman with other international currencies.
You can use it to keep money and financial related values in Rial
or Toman
in your applications. It handles
all the common logics, conversations and exchanges with international currencies for you.
It contains all the information about the international currencies based on
ISO 4217.
You can access all of these currencies in the CurrencySource
which is a static class. You can use it to find a specific currency by it's curencyCode
or symbol.
Features
- Representing ISO 4217 Currencies in a static class
- Find currencies based on it's symbol or numeric code
- Implements
Rial
class which encapsulates Iranian currency with a specific value - Provides data source for keeping
ExchangeRates
against other international currenciesTomanExchangeSource
- Converts Rial values to Toman (Unofficial Iranian Currency)
- Converts Rial values to another international currency based on rates defined in
TomanExchangeSource
How to Use
You clone this repo, build it and add reference to the output assembly, or simply install it via nuget.
dotnet add package Toman
Finding all international currencies
using Toman;
var all = CurrencySource.FindAll();
Find a currency based on it's symbol or code
using Toman;
var usd = CurrencySource.FindByCode("USD");
Creating a Rial value
using Toman;
var money = new Rial(100000);
Console.WriteLine($"Value: {money.Value}");
Setting an ExchangeRate for a specific Currency and creates Rial value from it
using Toman;
TomanExchangeSource.SetRate("USD", 500000);
var rial = Rial.From("USD", amount: 120.56);
Console.WriteLine($"120.56 USD = {rial.Value} rial and {rial.InToman()} toman");