Soenneker.Validators.ZipCode.Exists 4.0.2582

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Soenneker.Validators.ZipCode.Exists --version 4.0.2582
                    
NuGet\Install-Package Soenneker.Validators.ZipCode.Exists -Version 4.0.2582
                    
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="Soenneker.Validators.ZipCode.Exists" Version="4.0.2582" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Validators.ZipCode.Exists" Version="4.0.2582" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Validators.ZipCode.Exists" />
                    
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 Soenneker.Validators.ZipCode.Exists --version 4.0.2582
                    
#r "nuget: Soenneker.Validators.ZipCode.Exists, 4.0.2582"
                    
#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 Soenneker.Validators.ZipCode.Exists@4.0.2582
                    
#: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=Soenneker.Validators.ZipCode.Exists&version=4.0.2582
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Validators.ZipCode.Exists&version=4.0.2582
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

Soenneker.Validators.ZipCode.Exists

Validates US ZIP codes against the data snapshot packaged with the library.

Installation

dotnet add package Soenneker.Validators.ZipCode.Exists

Registration

Register the validator as a singleton when the application can share one in-memory ZIP-code set:

using Microsoft.Extensions.DependencyInjection;
using Soenneker.Validators.ZipCode.Exists.Registrars;

services.AddZipCodeExistsValidatorAsSingleton();

A scoped registration is also available:

services.AddZipCodeExistsValidatorAsScoped();

Each scoped instance loads and owns its own cached set. Prefer the singleton registration unless scopes need independent validator instances.

Usage

using Soenneker.Validators.ZipCode.Exists.Abstract;

public sealed class AddressService
{
    private readonly IZipCodeExistsValidator _zipCodeValidator;

    public AddressService(IZipCodeExistsValidator zipCodeValidator)
    {
        _zipCodeValidator = zipCodeValidator;
    }

    public ValueTask<bool> IsKnownZipCode(string zipCode, CancellationToken cancellationToken = default)
    {
        return _zipCodeValidator.Validate(zipCode, cancellationToken);
    }
}
await validator.Validate("00611");       // true when present in the packaged data
await validator.Validate("00611-5353");  // checks "00611"
await validator.Validate("12345");       // false when absent from the packaged data

Behavior

  • Null, empty, and whitespace-only values return false.
  • Values longer than five characters are truncated to their first five characters. This permits ZIP+4 input, but the suffix is not validated.
  • Values of five characters or fewer are matched exactly against the packaged data.
  • The data is loaded lazily on the first validation call and cached for the validator's lifetime.
  • A true result means the five-digit value appears in the package's data snapshot. It does not verify that an address exists or that mail can currently be delivered there.
  • Dispose the validator only when you own it directly. Instances resolved from dependency injection are disposed by the container.
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.2583 59 9/1/2026
4.0.2582 58 9/1/2026
4.0.2581 71 8/31/2026
4.0.2579 74 8/31/2026
4.0.2578 63 8/31/2026
4.0.2577 76 8/31/2026
4.0.2576 77 8/31/2026
4.0.2575 82 8/30/2026
4.0.2573 74 8/30/2026
4.0.2572 72 8/30/2026
4.0.2571 85 8/30/2026
4.0.2570 78 8/30/2026
4.0.2569 75 8/30/2026
4.0.2567 73 8/30/2026
4.0.2565 78 8/29/2026
4.0.2563 80 8/29/2026
4.0.2562 76 8/29/2026
4.0.2561 74 8/29/2026
4.0.2559 107 8/26/2026
4.0.2558 80 8/26/2026
Loading failed

Updated NuGet packages