GeoLocation.Data 1.0.1

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

GeoLocation.Data

A lightweight .NET library providing a complete, offline dataset of countries, states/provinces, and cities β€” with ISO country codes, flag emojis, and international dial codes derived on the fly. No API calls, no network dependency; the dataset ships embedded (Brotli-compressed) inside the package.

Install

dotnet add package GeoLocation.Data

Targets net10.0.

Quick start

using GeoLocation.Data;

var geo = new GeoLocationService();

// All countries, sorted alphabetically by name
IEnumerable<Country> countries = geo.GetAll();

// Look up a country by its 2-letter ISO code (case-insensitive)
Country? us = geo.GetByCountryCode("US");
Console.WriteLine($"{us!.FlagEmoji} {us.Name} (+{us.PhoneCode})"); // πŸ‡ΊπŸ‡Έ United States (+1)

// States/provinces for a country
IEnumerable<State> states = geo.GetStates("US");

// Cities for a given country + state id
var california = states.First(s => s.Name == "California");
IEnumerable<City> cities = geo.GetCities("US", california.Id);

// Find every country sharing an international dial code
IEnumerable<Country> plusOne = geo.GetByPhoneCode("+1"); // US, CA, ...

API

GeoLocationService

Method Description
GetAll() All countries, sorted alphabetically by name.
GetByCountryCode(string countryCode) Finds a country by ISO 3166-1 alpha-2 code (e.g. "US", "GB", "GR"). Case-insensitive; returns null if not found.
GetByPhoneCode(string phoneCode) Finds all countries matching an e.164 dial code (e.g. "1" or "+1").
GetStates(string? countryCode) States/provinces for a country, sorted alphabetically. Empty if the country code is missing or unknown.
GetCities(string? countryCode, int? stateId) Cities for a given country + state id, sorted alphabetically. Empty if either argument is missing or unknown.

Properties

  • Country β€” Id, Name, States, plus computed properties:
    • CountryCode β€” ISO alpha-2 code, derived from the flag emoji's Unicode codepoints
    • FlagEmoji β€” the flag emoji (e.g. πŸ‡ΊπŸ‡Έ)
    • PhoneCode β€” international dialing code (e.g. "1", "44")
    • Example β€” a sample local phone number for the country
    • DisplayName β€” "United States (US)"
  • State β€” Id, Name, Cities
  • City β€” Id, Name
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 (1)

Showing the top 1 NuGet packages that depend on GeoLocation.Data:

Package Downloads
CountryPicker.Blazor

A lightweight, high-performance, and beautifully styled CountryPicker component for Blazor, ported from the popular country_picker Flutter package by Daniel Ioannou. Features searchable dropdown combobox, customizable favorites, exclusions, and dialing codes, using zero-asset native emoji flags.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 118 8/9/2026
1.0.0 95 8/8/2026