Iso4217Extensions Class

Definition

Namespace: DataStandardizer.Money

Extension methods that read the metadata attached to the ISO 4217 currency code enums.

public static class Iso4217Extensions

Remarks

Each accessor reads the Iso4217CurrencyCodeAttribute applied to the enum member and returns the requested metadata, or null when it is unavailable.

Methods

Extension

Method Extends Returns Notes
GetCurrencyName() Iso4217CurrencyCurrent string? Currency name, or null if unavailable.
GetCurrencyName() Iso4217CurrencyHistoric string? Currency name for a historic code, or null.
GetCurrencySymbol() Iso4217CurrencyCurrent string? Standard currency symbol, or null if none is defined.
GetCurrencySymbol(CurrencySymbolKind) Iso4217CurrencyCurrent string? Currency symbol in the requested form, or null.
GetCurrencySymbol() Iso4217CurrencyHistoric string? Standard currency symbol for a historic code, or null.
GetCurrencySymbol(CurrencySymbolKind) Iso4217CurrencyHistoric string? Currency symbol for a historic code in the requested form, or null.
GetMinorUnits() Iso4217CurrencyCurrent byte? Number of minor-unit digits, or null.
IsFundCode() Iso4217CurrencyCurrent bool true if the code is a funds code.
IsNationalCurrency() Iso4217CurrencyCurrent bool true for a national currency code; false for a funds code.
IsSupranationalCurrency() Iso4217CurrencyCurrent bool true for a supranational currency code.

Currency symbols

ISO 4217 defines no currency symbols, so they are sourced from the Unicode Common Locale Data Repository rather than from the currency code standard itself. Most currencies have no symbol distinct from their code, in which case GetCurrencySymbol returns null and the currency code should be used.

Two forms are published. The standard form distinguishes currencies that share a glyph, such as NZ$ for the New Zealand Dollar, though it may be another currency’s narrow form, as $ is. The narrow form is the shortest recognisable form and may be shared, as $ is by some thirty currencies. Where a currency has no distinct narrow form, the standard form is returned. See CurrencySymbolKind.

Historic codes that share a numeric code

ISO 4217 reuses numeric codes across successive denominations, so several Iso4217CurrencyHistoric members can share a value, such as BGJ, BGK and BGL (100). The codes that have no numeric code (XFO, XFU and XRE) all share -1. Members that share a value are the same value, so these methods can’t tell them apart, and GetCurrencyName and GetCurrencySymbol return null for a shared value:

Iso4217CurrencyHistoric.BGL.GetCurrencyName();  // null: BGJ, BGK and BGL are the same value
Iso4217CurrencyHistoric.HRK.GetCurrencySymbol(CurrencySymbolKind.Narrow);  // null: HRD and HRK are the same value
Iso4217CurrencyHistoric.BEF.GetCurrencyName();  // "Belgian Franc": 56 isn't shared

See Iso4217CurrencyHistoric.

Applies to

Targets netstandard1.1, netstandard2.0, and net10.0.

See also


This site uses Just the Docs, a documentation theme for Jekyll.