CurrencyLookupService Class
Definition
- Namespace
- Bodu.Financial.Currencies
- Assembly
- Bodu.Financial.dll
- Package
- Bodu.Financial 1.0.0
- Source
- CurrencyLookupService.cs
Default ICurrencyLookup backed by CurrencyRegistry. Reverse indexes for numeric code, symbol, and region are built lazily from a snapshot of the registry taken on first use.
public sealed class CurrencyLookupService : ICurrencyLookup
- Inheritance
-
CurrencyLookupService
- Implements
- Inherited Members
- Extension Methods
Remarks
The reverse indexes reflect the registry contents at the time of first access. Construct a new instance after registering custom currencies that must participate in symbol, numeric, or region lookups.
Constructors
CurrencyLookupService()
Initializes a new instance of the CurrencyLookupService class.
public CurrencyLookupService()
Methods
ByCulture(CultureInfo)
Resolves the currencies associated with culture's region.
public IReadOnlyList<CurrencyInfo> ByCulture(CultureInfo culture)
Parameters
cultureCultureInfoThe culture whose region currency is resolved.
Returns
- IReadOnlyList<CurrencyInfo>
The matching currencies, or an empty list when none are found.
TryByCurrencyCode(CurrencyCode, out CurrencyInfo)
Attempts to resolve a currency by its CurrencyCode enum value.
public bool TryByCurrencyCode(CurrencyCode code, out CurrencyInfo currency)
Parameters
codeCurrencyCodeThe active ISO 4217 currency code.
currencyCurrencyInfoWhen this method returns true, the matching currency.
Returns
TryByIsoCode(string, out CurrencyInfo)
Attempts to resolve a currency by its ISO 4217 alphabetic code.
public bool TryByIsoCode(string isoCode, out CurrencyInfo currency)
Parameters
isoCodestringThe three-letter uppercase ISO code.
currencyCurrencyInfoWhen this method returns true, the matching currency.
Returns
TryByNumericCode(int, out CurrencyInfo)
Attempts to resolve a currency by its ISO 4217 numeric code.
public bool TryByNumericCode(int numericCode, out CurrencyInfo currency)
Parameters
numericCodeintThe three-digit numeric code.
currencyCurrencyInfoWhen this method returns true, the matching currency.
Returns
TryByRegion(string, out IReadOnlyList<CurrencyInfo>)
Attempts to resolve the currencies used in the region identified by regionCode.
public bool TryByRegion(string regionCode, out IReadOnlyList<CurrencyInfo> matches)
Parameters
regionCodestringThe ISO 3166 region code.
matchesIReadOnlyList<CurrencyInfo>When this method returns true, the matching currencies.
Returns
TryBySymbol(string, out IReadOnlyList<CurrencyInfo>)
Attempts to resolve the currencies that use symbol as a primary or alternative symbol.
public bool TryBySymbol(string symbol, out IReadOnlyList<CurrencyInfo> matches)
Parameters
symbolstringThe currency symbol.
matchesIReadOnlyList<CurrencyInfo>When this method returns true, the matching currencies.
Returns
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |