Zip2City 2.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Zip2City --version 2.1.0
NuGet\Install-Package Zip2City -Version 2.1.0
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="Zip2City" Version="2.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Zip2City --version 2.1.0
#r "nuget: Zip2City, 2.1.0"
#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.
// Install Zip2City as a Cake Addin
#addin nuget:?package=Zip2City&version=2.1.0

// Install Zip2City as a Cake Tool
#tool nuget:?package=Zip2City&version=2.1.0

Zip2City

Provides fast, in-memory lookup of the postal service city/state names by zip code. All 50 states, DC, PR, VI, and AE. Data current as of September 28, 2021. No external library dependencies. No external calls.

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

  • Light-weight (430KB)
  • No external library dependencies
  • No external calls

.GetDefaultCityState(zipcode)

var zipcode = "90210";
var cityAndState = Zip2City.GetDefaultCityState(zipcode);  // returns null when there's no match

var city = cityAndState[0];  // "BEVERLY HILLS"
var state = cityAndState[1];  // "CA"

.GetAllCityStates(zipcode)

var zipcode = "37411";
var citysAndStates = Zip2City.GetAllCityStates(zipcode).ToArray();  // returns IEnumerable<string[]> regardless of whether there is a match

var defaultCity = citysAndStates[0];  // "CHATTANOOGA"
var defaultState = citysAndStates[0][1];  // "TN"
var city2 = citysAndStates[1][0];  // "RIDGESIDE"
var state2 = citysAndStates[1][1];  // "TN"

.GetRandomCityStateZip()

var randomCityStateZip = Zip2City.GetRandomCityStateZip();  // always returns a valid set of city, state, and zip code.

var city = cityAndState[0];  // "TROY"
var state = cityAndState[1];  // "TX"
var zipcode = cityAndState[1];  // "76579"
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 is compatible. 
.NET Standard netstandard2.1 is compatible. 
.NET Framework net20 is compatible.  net35 was computed.  net40 is compatible.  net403 was computed.  net45 was computed.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETCoreApp 3.1

    • No dependencies.
  • .NETFramework 2.0

    • No dependencies.
  • .NETFramework 4.0

    • No dependencies.
  • .NETStandard 2.1

    • No dependencies.
  • net5.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
3.0.0 28,181 3/12/2022
2.1.0 3,085 10/9/2021
2.0.0 868 10/7/2021
1.0.3 5,432 10/18/2020

* Complete data for all 50 states, DC, PR, VI, and AE
* Current as of September 28, 2021
* Multi-Framework Support (.NET 5, .NET Core 3.1, .NET Standard 2.1, .NET 4.0 and .NET 2.0)
* Small assembly size (approx. 430KB)
* Unit tested