Class Currency
Provides information about a currency, such as the currency code, localized names, symbol and decimal digits.
Implements
Namespace: Singulink.Globalization
Assembly: Singulink.Globalization.Currency.dll
Syntax
public class Currency : IFormattable
Constructors
Name | Description |
---|---|
Currency(string, int, ICurrencyLocalizer) | Initializes a new instance of the Currency class using the specified localizer to provide localized currency names and symbols. |
Currency(string, int, string, string?) | Initializes a new instance of the Currency class without localization. |
Properties
Name | Description |
---|---|
CurrencyCode | Gets the currency code assigned to the currency, which is the three letter ISO currency code for system currencies. |
DecimalDigits | Gets the standard number of decimal digits for monetary amounts of this currency. |
MinorUnit | Gets a monetary amount representing the minor unit of the currency based on the number of decimal digits it has (i.e. USD will return |
Name | Gets the invariant name of this currency. Returns the English name for system currencies. To get the localized name use GetLocalizedName(CultureInfo?). |
Symbol | Gets the invariant symbol of this currency. To get the localized symbol use GetLocalizedSymbol(CultureInfo?). |
Methods
Name | Description |
---|---|
GetCurrency(string) | Gets the currency associated with the specified currency code from the Default registry. |
GetLocalizedName(CultureInfo?) | Gets the localized name for the currency in the specified culture (or the current culture if no culture is provided). |
GetLocalizedSymbol(CultureInfo?) | Gets the localized symbol for the currency in the specified culture (or the current culture if no culture is provided). |
IsSymbolOrCodeParsable(string, out string?) | Checks whether the specified symbol/code can be reliably parsed. If this method returns false, then adding a currency that uses the symbol/code to a currency registry will cause parsing operations that depend on the offending symbol/code to throw an `InvalidOperationException, as it may otherwise result in unpredictable parsing errors or incorrect results. |
ToString() | Returns the localized string representation of the currency containing the currency's name and currency code. |
ToString(string?, CultureInfo?) | Returns a localized string representation of the currency using the specified format and culture. |
TryGetCurrency(string, out Currency) | Gets the currency associated with the specified currency code from the Default registry. |
TryGetLocalCurrency(out Currency) | Gets the local currency for the current culture using the Default currency registry. Culture must be region-specific for this method to succeed. |
TryGetLocalCurrency(CultureInfo, out Currency) | Gets the local currency for the specified culture using the Default currency registry. Culture must be region-specific for this method to succeed. |
TryGetLocalCurrency(RegionInfo, out Currency) | Gets the local currency for the specified region using the Default currency registry. |
Explicit Interface Implementations
Name | Description |
---|---|
IFormattable.ToString(string?, IFormatProvider?) | Returns a localized string representation of the currency using the specified format and format provider. If the format provider is not a CultureInfo instance, it is ignored and the current culture is used instead. |