WorldRef 1.1.2

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

worldref for C# (.NET)

Offline reference data for 242 countries and territories in Arabic and English: names, flags, dial plans, currencies, geography, subdivisions. Search, sorting and phone parsing behave identically to the JavaScript package.

The library targets net8.0 and has no dependencies beyond the base library. The data is embedded in the assembly.

Install

dotnet add package WorldRef

Usage

using WorldRef;

var sa = Dataset.Find("sa")!;                                   // case-insensitive
Console.WriteLine($"{sa.Flag} {sa.NameAr} / {sa.NameEn}");
var hits = Lookup.Search(Dataset.Countries, "السعودية", Lang.Ar); // best match first
var sorted = Lookup.SortCountries(Dataset.Countries, Lang.Ar, first: "SA");
var phone = Lookup.ParsePhone("0501234567", sa, Dataset.Countries);
Console.WriteLine($"{phone?.E164} valid={phone?.Valid} mobile={phone?.Mobile}");
Console.WriteLine(Lookup.IsValidMobile("+966501234567", sa, Dataset.Countries));
Console.WriteLine(Text.Normalize("المملكة العربية السعودية"));     // folded form used for matching
Console.WriteLine(Dataset.SubdivisionsOf("SA").Count);

Models are records (Country, PhonePlan, Currency, Subdivision, ...) with PascalCase properties mapped from the snake_case JSON fields, for example NameAr, Geo.AreaKm2, Phone[0].MobilePattern.

Tests

cd csharp && dotnet test

The suite loads tests/vectors.json from the repository root, so run it from a full checkout.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.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.1.2 46 11/4/2026
1.1.1 44 11/4/2026
1.1.0 49 11/4/2026