HawkN.Iso.Currencies
8.0.1
dotnet add package HawkN.Iso.Currencies --version 8.0.1
NuGet\Install-Package HawkN.Iso.Currencies -Version 8.0.1
<PackageReference Include="HawkN.Iso.Currencies" Version="8.0.1" />
<PackageVersion Include="HawkN.Iso.Currencies" Version="8.0.1" />
<PackageReference Include="HawkN.Iso.Currencies" />
paket add HawkN.Iso.Currencies --version 8.0.1
#r "nuget: HawkN.Iso.Currencies, 8.0.1"
#:package HawkN.Iso.Currencies@8.0.1
#addin nuget:?package=HawkN.Iso.Currencies&version=8.0.1
#tool nuget:?package=HawkN.Iso.Currencies&version=8.0.1
HawkN.Iso.Currencies
HawkN.Iso.Currencies provides ISO 4217 currency codes, historical currency data, and replacement mappings.
Features
- Actual currency list - Provides a complete and up-to-date set of currency codes and their details according to the ISO 4217 standard.
- Strongly typed currency codes –
CurrencyCodeenum is generated at compile-time. - Historical currency support – Access withdrawn currencies.
- Lightweight & Dependency-Free – Minimal overhead, compatible with .NET 8 and above.
- Integration ready – Use in libraries, console apps, or web applications.
Getting Started
Install via NuGet
dotnet add package HawkN.Iso.Currencies
Required Namespaces
using HawkN.Iso.Currencies;
using HawkN.Iso.Currencies.Abstractions;
using HawkN.Iso.Currencies.Models;
using HawkN.Iso.Currencies.Extensions;
Usage Example
Registration
Use extension method .AddCurrencyService();
using var host = Host.CreateDefaultBuilder(args)
.ConfigureServices(services =>
{
services.AddCurrencyService();
})
.Build();
To get service instance:
var currencyService = scope.ServiceProvider.GetRequiredService<ICurrencyService>();
or inject
app.MapGet("/weatherforecast", ([FromServices] ICurrencyService currencyService) => ...
Get all existing currencies
var currencyService = scope.ServiceProvider.GetRequiredService<ICurrencyService>();
var currencies = currencyService?.Query()
.Includes
.Type(CurrencyType.Fiat)
.Type(CurrencyType.SpecialUnit)
.Type(CurrencyType.SpecialReserve)
.Type(CurrencyType.PreciousMetal)
.Build();
Get fiat currencies
var currencyService = scope.ServiceProvider.GetRequiredService<ICurrencyService>();
var currencies = currencyService?.Query()
.Includes
.Type(CurrencyType.Fiat)
.Build();
Get currencies by query
Excludes EUR and USD from the list:
var currencies = currencyService?.Query()
.Includes
.Type(CurrencyType.Fiat)
.Without(w => w.Codes(nameof(CurrencyCode.EUR), nameof(CurrencyCode.USD)))
.Build();
Includes only EUR and USD in the list:
var currencies = currencyService?.Query()
.Includes
.Type(CurrencyType.Fiat)
.With(w => w.Codes("EUR", "usd"))
.Build();
Get currencies by advanced query (LINQ)
Includes only EUR and USD in the list:
var currencies = currencyService?.Query()
.Includes
.Type(CurrencyType.Fiat)
.Where(q => q.Code is "EUR" or nameof(CurrencyCode.USD))
.Build();
Get historical currencies
var historical = currencyService.GetAllHistorical();
foreach (var currency in historical)
{
Console.WriteLine($"{currency.Code} - {currency.Name} (Withdrawn: {currency.WithdrawnOn})");
}
Lookup currency
By string code
var afnWithString = currencyService.Get("AFN");
By currency code
var afnWithCode = currencyService.Get(CurrencyCode.AFN);
Validate currency
By string code
var validResult = currencyService.TryValidate("AFN", out var validateResult);
By currency code
var validResult = currencyService.TryValidate(CurrencyCode.AFN, out var validateResult);
Supported currencies
See the currency list with the link
Last updated at 16.01.2026
Generated Types
CurrencyCode– strongly-typed enum with all ISO 4217 codes.Currency– domain model representing a currency (code, name, numeric code, withdrawn date).
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.ISO 4217 currency codes dataset
Source: https://github.com/datasets/currency-codes
Licensed under the Open Database License (ODbL) v1.0.
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
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on HawkN.Iso.Currencies:
| Package | Downloads |
|---|---|
|
HawkN.Iso.Countries.Currencies
Provides mapping between countries and currencies (primary and secondary). Includes extension methods to query primary, secondary, or all currencies and check usage. |
GitHub repositories
This package is not used by any popular GitHub repositories.
- Added support for .NET 8.0
- Strongly typed CurrencyCode enum generated at compile time
- Lightweight & dependency-free