Soenneker.Validators.ZipCode.Exists 4.0.2575

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.2575
                    
NuGet\Install-Package Soenneker.Validators.ZipCode.Exists -Version 4.0.2575
                    
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.2575" />
                    
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.2575" />
                    
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.2575
                    
#r "nuget: Soenneker.Validators.ZipCode.Exists, 4.0.2575"
                    
#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.2575
                    
#: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.2575
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Validators.ZipCode.Exists&version=4.0.2575
                    
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.2578 0 8/31/2026
4.0.2577 0 8/31/2026
4.0.2576 0 8/31/2026
4.0.2575 0 8/30/2026
4.0.2573 0 8/30/2026
4.0.2572 24 8/30/2026
4.0.2571 42 8/30/2026
4.0.2570 37 8/30/2026
4.0.2569 36 8/30/2026
4.0.2567 36 8/30/2026
4.0.2565 41 8/29/2026
4.0.2563 43 8/29/2026
4.0.2562 38 8/29/2026
4.0.2561 36 8/29/2026
4.0.2559 98 8/26/2026
4.0.2558 72 8/26/2026
4.0.2557 67 8/26/2026
4.0.2556 69 8/26/2026
4.0.2555 100 8/22/2026
4.0.2554 81 8/22/2026
Loading failed

Update dependency Soenneker.Utils.Paths.Resources to 4.0.223 (#3088)