Zip2City 3.0.0
dotnet add package Zip2City --version 3.0.0
NuGet\Install-Package Zip2City -Version 3.0.0
<PackageReference Include="Zip2City" Version="3.0.0" />
paket add Zip2City --version 3.0.0
#r "nuget: Zip2City, 3.0.0"
// Install Zip2City as a Cake Addin #addin nuget:?package=Zip2City&version=3.0.0 // Install Zip2City as a Cake Tool #tool nuget:?package=Zip2City&version=3.0.0
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.
- 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"
.GetClosestCityState(zipcode)
var zipcode = "99999";
var cityAndState = Zip2City.GetClosestCityState(zipcode);
var city = cityAndState[0]; // "KETCHIKAN"
var state = cityAndState[1]; // "AK"
.GetClosestCityStates(zipcode)
var zipcode = "37411";
var citysAndStates = Zip2City.GetClosestCityStates(zipcode).ToArray();
var defaultCity = citysAndStates[0]; // "KETCHIKAN"
var defaultState = citysAndStates[0][1]; // "AK"
var city2 = citysAndStates[1][0]; // "EDNA BAY"
var state2 = citysAndStates[1][1]; // "AK"
var city3 = citysAndStates[2][0]; // "KASAAN"
var state3 = citysAndStates[2][1]; // "AK"
.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"
.GetRandomCityStateZip(random)
var random = new Random(12345); // seeding will guarantee the return values
var randomCityStateZip = Zip2City.GetRandomCityStateZip(random);
var city = cityAndState[0]; // "ALBANY"
var state = cityAndState[1]; // "GA"
var zipcode = cityAndState[1]; // "31707"
.AllCityStateZips
var allData = Zip2City.AllCityStateZips
var californiaData = allData.Where(d => d[1] == "CA").ToArray()
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. 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 | 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. |
-
.NETCoreApp 3.1
- No dependencies.
-
.NETFramework 4.0
- No dependencies.
-
.NETStandard 2.1
- No dependencies.
-
net5.0
- No dependencies.
-
net6.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.
3.0.0
* (BREAKING CHANGE) Ended .NET 2.0 support
* (BREAKING CHANGE) Introduced namespace
* Added .GetClosestCityState(zipcode) and .GetClosestCityStates(zipcode) for the exact or the closest match
* Optimized .GetRandomCityStateZip() implementation
* Added .GetRandomCityStateZip(random) for predictable values
* Added static property to get all data
* Added .NET 6 support