ISOCodex.Addressing 1.0.0-alpha.1

This is a prerelease version of ISOCodex.Addressing.
There is a newer version of this package available.
See the version list below for details.
dotnet add package ISOCodex.Addressing --version 1.0.0-alpha.1
                    
NuGet\Install-Package ISOCodex.Addressing -Version 1.0.0-alpha.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ISOCodex.Addressing" Version="1.0.0-alpha.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ISOCodex.Addressing" Version="1.0.0-alpha.1" />
                    
Directory.Packages.props
<PackageReference Include="ISOCodex.Addressing" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ISOCodex.Addressing --version 1.0.0-alpha.1
                    
#r "nuget: ISOCodex.Addressing, 1.0.0-alpha.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ISOCodex.Addressing@1.0.0-alpha.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ISOCodex.Addressing&version=1.0.0-alpha.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=ISOCodex.Addressing&version=1.0.0-alpha.1&prerelease
                    
Install as a Cake Tool

ISOCodex.Addressing

ISOCodex.Addressing provides a small .NET domain model for postal addresses plus country-specific address validation through a validator factory.

Features

  • ISO 3166-1 alpha-2 country code value object
  • Lightweight postal code value object
  • Address model suitable for application/domain use
  • Country-specific validation via IAddressValidator
  • DI registration for selected built-in validators
  • Built-in support for:
    • Great Britain (GB)
    • United States (US)
    • Canada (CA)

Installation

dotnet add package ISOCodex.Addressing

Core types

  • Address
  • CountryCode
  • PostalCode
  • IAddressValidator
  • IAddressValidatorFactory

Register validators with DI

using ISOCodex.Addressing;
using ISOCodex.Addressing.Validation;
using Microsoft.Extensions.DependencyInjection;

var services = new ServiceCollection();

services.AddAddressing(
    CountryCode.GB,
    CountryCode.US,
    CountryCode.CA);

using var serviceProvider = services.BuildServiceProvider();

var validatorFactory = serviceProvider.GetRequiredService<IAddressValidatorFactory>();

Validate an address

using ISOCodex.Addressing;

var address = new Address(
    line1: "10 Downing Street",
    line2: null,
    city: "London",
    stateOrProvince: null,
    postalCode: new PostalCode("SW1A 2AA"),
    countryCode: CountryCode.GB);

validatorFactory.GetValidator(address.CountryCode).Validate(address);

Country-specific notes

Great Britain (GB)

  • Validates postcode format
  • Expects uppercase postcode format with a space, for example SW1A 1AA

United States (US)

  • Validates ZIP or ZIP+4
  • Requires StateOrProvince
  • Accepts US state and territory abbreviations

Canada (CA)

  • Validates postal code format such as A1A 1A1
  • Province/territory is optional
  • If provided, province/territory must be a valid abbreviation

Extension packages

Country support can be extended through additional packages. Spain support is provided by the separate ISOCodex.Addressing.Spain project in the repository rather than by this core package.

Important behaviour

  • PostalCode itself does not enforce country-specific formatting
  • Validation is performed by the country validator
  • Validators normalize common postal-code casing and spacing for validation without changing the stored PostalCode.Code
  • AddAddressing(...) only registers the validators you explicitly request

License

MIT

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (12)

Showing the top 5 NuGet packages that depend on ISOCodex.Addressing:

Package Downloads
ISOCodex.Addressing.Spain

Spain-specific extension package for ISOCodex.Addressing.

ISOCodex.Addressing.Ireland

Ireland-specific extension package for ISOCodex.Addressing.

ISOCodex.Addressing.France

France-specific extension package for ISOCodex.Addressing.

ISOCodex.Currency.Addressing

Address and currency validation helpers for ISOCodex.Currency and ISOCodex.Addressing.

ISOCodex.Addressing.Canada

Canada-specific extension package for ISOCodex.Addressing.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.1 499 6/23/2026
2.0.0 567 6/23/2026
2.0.0-alpha 465 6/20/2026
1.3.0 634 6/20/2026
1.2.0 327 6/14/2026
1.1.0 224 6/14/2026
1.0.0 139 6/14/2026
1.0.0-alpha.4 72 6/14/2026
1.0.0-alpha.3 64 6/13/2026
1.0.0-alpha.2 67 6/13/2026
1.0.0-alpha.1 70 6/13/2026