VN.Address 1.0.1

dotnet add package VN.Address --version 1.0.1
                    
NuGet\Install-Package VN.Address -Version 1.0.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="VN.Address" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="VN.Address" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="VN.Address" />
                    
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 VN.Address --version 1.0.1
                    
#r "nuget: VN.Address, 1.0.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 VN.Address@1.0.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=VN.Address&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=VN.Address&version=1.0.1
                    
Install as a Cake Tool

VN.Address

VN.Address is a high-performance, ultra-lightweight .NET 10 library designed to validate Vietnamese administrative units (Provinces and Wards/Communes) using the latest 2025 administrative data.

Leveraging the power of .NET 10, this library provides near-instant validation and minimal memory footprint, making it ideal for high-traffic web applications and microservices.

Key Features

  • 2025 Data Ready: Fully updated with the most recent National Assembly resolutions on administrative boundaries.
  • Built for .NET 10: Utilizes modern features like FrozenDictionary, FrozenSet, and Source-generated Regex for peak performance.
  • Extreme Performance: Uses Frozen Collections to provide lookup speeds with optimized memory layout.
  • Zero Configuration: The database is embedded as a resource within the assembly—no external files or setup required.
  • Advanced Validation: Includes a source-generated Regex engine to validate Vietnamese Unicode characters safely.
  • AOT-Friendly: Designed to be compatible with Native AOT deployments.

Installation

Install the package via NuGet:

dotnet add package VN.Address

Usage

1. Character & Security Validation

Validate if an input string contains only safe, valid Vietnamese characters. Powered by Source Generators to eliminate runtime Regex compilation.

using VN.Address;

bool isSafe = AddressService.IsValidCharacters("Thành phố Hà Nội"); // True
bool isUnsafe = AddressService.IsValidCharacters("Hanoi <script>"); // False

2. Province Validation

Check if a province exists in the 2025 dataset.

bool exists = AddressService.IsValidProvince("Thành phố Hà Nội"); // True
bool notFound = AddressService.IsValidProvince("Tỉnh Wakanda"); // False

3. Strict Address Pairing

The most critical check for data integrity - verify if a Ward/Commune strictly belongs to a specific Province.

// Valid pair
bool validPair = AddressService.IsValidAddressPair("Thành phố Hà Nội", "Phường Ba Đình"); // True

// Mismatch check (Phường Bến Thành belongs to HCM City)
bool invalidPair = AddressService.IsValidAddressPair("Thành phố Hà Nội", "Phường Bến Thành"); // False

4. Data Retrieval

Access the internal datasets for UI components like dropdowns or search suggestions. (Updated in version 1.0.1)

// Get all province names
IEnumerable<string> provinces = AddressService.GetAllProvinces();

// Access the entire frozen database for advanced custom logic
var fullDatabase = AddressService.GetAllAddresses();

Data Source

Administrative data is sourced and flattened from the dvhcvn repository (2025 Version).

License

This project is licensed under the MIT License.

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.
  • net10.0

    • No dependencies.

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
1.0.1 112 2/11/2026
1.0.0 96 2/10/2026