Constructor Currency
Currency(string, int, string, string?)
Initializes a new instance of the Currency class without localization.
Declaration
public Currency(string currencyCode, int decimalDigits, string name, string? symbol = null)
Parameters
Type | Name | Description |
---|---|---|
string | currencyCode | The unique currency code of the currency, typically the three letter ISO code, i.e. |
int | decimalDigits | The number of decimal digits that is standard for the currency. |
string | name | The name of the currency, i.e. |
string | symbol | The currency symbol, i.e. |
Remarks
NOTE: Currency codes and symbols are not validated as parsable to allow this library to be used for a wide range of usages (such as defining cryptocurrencies, some of which do conform to ISO 4217 standards that ensure values can be reliably parsed). If you create a currency that contains unparsable symbols/codes, then any parsing operations that depend on the offending symbol/code will throw an InvalidOperationException. See IsSymbolOrCodeParsable(string, out string?) for more information on this topic.
Currency(string, int, ICurrencyLocalizer)
Initializes a new instance of the Currency class using the specified localizer to provide localized currency names and symbols.
Declaration
public Currency(string currencyCode, int decimalDigits, ICurrencyLocalizer localizer)
Parameters
Type | Name | Description |
---|---|---|
string | currencyCode | The unique currency code of the currency, typically the three letter ISO code, i.e. |
int | decimalDigits | The number of decimal digits that is standard for the currency. |
ICurrencyLocalizer | localizer | The currency localizer implementation that provides localized names and symbols for the currency. |
Remarks
NOTE: Currency codes and symbols are not validated as parsable to allow this library to be used for a wide range of usages (such as defining cryptocurrencies, some of which do conform to ISO 4217 standards that ensure values can be reliably parsed). If you create a currency that contains unparsable symbols/codes, then any parsing operations that depend on the offending symbol/code will throw an InvalidOperationException. See IsSymbolOrCodeParsable(string, out string?) for more information on this topic.