HawkN.Iso.Countries.Currencies
8.0.2
dotnet add package HawkN.Iso.Countries.Currencies --version 8.0.2
NuGet\Install-Package HawkN.Iso.Countries.Currencies -Version 8.0.2
<PackageReference Include="HawkN.Iso.Countries.Currencies" Version="8.0.2" />
<PackageVersion Include="HawkN.Iso.Countries.Currencies" Version="8.0.2" />
<PackageReference Include="HawkN.Iso.Countries.Currencies" />
paket add HawkN.Iso.Countries.Currencies --version 8.0.2
#r "nuget: HawkN.Iso.Countries.Currencies, 8.0.2"
#:package HawkN.Iso.Countries.Currencies@8.0.2
#addin nuget:?package=HawkN.Iso.Countries.Currencies&version=8.0.2
#tool nuget:?package=HawkN.Iso.Countries.Currencies&version=8.0.2
HawkN.Iso.Countries.Currencies
HawkN.Iso.Countries.Currencies provides ISO-based mapping of primary and secondary currencies for countries. It allows you to quickly retrieve the main currency, secondary currencies, all currencies, or check if a currency is used by a specific country.
Features
- Primary and Secondary Currencies – Get the main currency or all secondary currencies of a country.
- Fast Lookups – O(1) lookups using pre-indexed dictionaries and HashSet for secondary currencies.
- Currency Validation – Check if a country uses a given currency.
- Seamless Integration – Built to work with
HawkN.Iso.Countriestypes (CountryCode.TwoLetterCode). - Lightweight & Dependency-Free – Compatible with .NET 8 and above.
Getting Started
Install via NuGet
dotnet add package HawkN.Iso.Countries.Currencies
References
- HawkN.Iso.Countries – Provides country codes and models.
- HawkN.Iso.Currencies – Provides currency codes and enums.
Required Namespaces
using HawkN.Iso.Currencies;
using HawkN.Iso.Countries;
using HawkN.Iso.Countries.Abstractions;
using HawkN.Iso.Countries.Extensions;
using HawkN.Iso.Currencies.Extensions;
using HawkN.Iso.Countries.Currencies.Extensions;
Usage Example
Get Main Currency
var mainCurrency = CountryCode.TwoLetterCode.US.GetPrimaryCurrency();
Console.WriteLine($"Primary currency of US: {mainCurrency}"); // USD
Get Secondary Currencies
var secondaryCurrencies = CountryCode.TwoLetterCode.BO.GetSecondaryCurrencies();
Console.WriteLine($"Secondary currencies of BO: {string.Join(", ", secondaryCurrencies)}"); // BOV
Get all Currencies for specific country
var allCurrencies = CountryCode.TwoLetterCode.BO.GetAllCurrencies();
Console.WriteLine($"All currencies of BO: {string.Join(", ", allCurrencies)}"); // BOB, BOV
Validation
Check if Currency is Used by Country
bool isUsed = CountryCode.TwoLetterCode.BO.IsCurrencyUsedByCountry(CurrencyCode.BOB); // True
bool isUsdUsed = CountryCode.TwoLetterCode.BO.IsCurrencyUsedByCountry(CurrencyCode.USD); // False
License
Code
This project’s source code is licensed under the MIT License.
Data
This project uses data derived from the following sources:
Unicode Common Locale Data Repository (CLDR)
Licensed under the Unicode License Agreement.Country data (
ISO 3166-1andUN M49numeric codes) is sourced from the UN Statistics Division – M49 standard
The above data licenses are permissive and compatible with MIT-licensed code
when used for reference and code generation.
See DATA-LICENSE for details.
References
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- HawkN.Iso.Countries (>= 8.0.0 && < 9.0.0)
- HawkN.Iso.Currencies (>= 8.0.0 && < 9.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
- Added support for .NET 8.0
- Initial release with Country - Currency mapping.
- Lightweight & dependency-free