Table of Contents

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

culture CultureInfo

The 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

code CurrencyCode

The active ISO 4217 currency code.

currency CurrencyInfo

When this method returns true, the matching currency.

Returns

bool

true when a currency was found; otherwise false.

TryByIsoCode(string, out CurrencyInfo)

Attempts to resolve a currency by its ISO 4217 alphabetic code.

public bool TryByIsoCode(string isoCode, out CurrencyInfo currency)

Parameters

isoCode string

The three-letter uppercase ISO code.

currency CurrencyInfo

When this method returns true, the matching currency.

Returns

bool

true when a currency was found; otherwise false.

TryByNumericCode(int, out CurrencyInfo)

Attempts to resolve a currency by its ISO 4217 numeric code.

public bool TryByNumericCode(int numericCode, out CurrencyInfo currency)

Parameters

numericCode int

The three-digit numeric code.

currency CurrencyInfo

When this method returns true, the matching currency.

Returns

bool

true when a currency was found; otherwise false.

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

regionCode string

The ISO 3166 region code.

matches IReadOnlyList<CurrencyInfo>

When this method returns true, the matching currencies.

Returns

bool

true when at least one currency was found; otherwise false.

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

symbol string

The currency symbol.

matches IReadOnlyList<CurrencyInfo>

When this method returns true, the matching currencies.

Returns

bool

true when at least one currency was found; otherwise false.

Applies to

ProductVersions
.NET8, 10