CountryCollection 1.1.0

dotnet add package CountryCollection --version 1.1.0                
NuGet\Install-Package CountryCollection -Version 1.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="CountryCollection" Version="1.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CountryCollection --version 1.1.0                
#r "nuget: CountryCollection, 1.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 CountryCollection as a Cake Addin
#addin nuget:?package=CountryCollection&version=1.1.0

// Install CountryCollection as a Cake Tool
#tool nuget:?package=CountryCollection&version=1.1.0                

.Contains(code)

string code = "US";
bool valid = CountryCollection.Contains(code);  // True

.Contains(code)

string lowerCased = "us";
bool valid = CountryCollection.Contains(lowerCased);  // True

.Contains(code)

int numericCode = 840;
bool valid = CountryCollection.Contains(numericCode);  // True

.Normalize(code)

string iso2DigitCode = "us";
string code = CountryCollection.Normalize(iso2DigitCode);  // "US"

.Normalize(code)

string iso3DigitCode = "usa";
string code = CountryCollection.Normalize(iso3DigitCode);  // "USA"

.Normalize(code)

int numericCode = 32;
string code = CountryCollection.Normalize(numericCode);  // "032" (Argentina)

.Normalize(code)

string invalidCode = "xyz";
string code = CountryCollection.Normalize(invalidCode);  // null

.Normalize(code)

int numericCode = 99999;
string code = CountryCollection.Normalize(numericCode);  // null

.GetCountry(code)

string code = "US";
var country = CountryCollection.GetCountry(code);  // { "IsoAlpha2Code":"US", "IsoAlpha3Code":"USA", "IsoNumeric":840, "IsoEnglishShortName":"United States of America (the)", "Name":"United States" }

.GetCountry(code)

string invalidCode = "XYZ";
var country = CountryCollection.GetCountry(code);  // null

instance.[code]

string code = "US";
var country = new CountryCollection[code];  // { "IsoAlpha2Code":"US", "IsoAlpha3Code":"USA", "IsoNumeric":840, "IsoEnglishShortName":"United States of America (the)", "Name":"United States" }

instance.Add(isoAlpha2Code, isoAlpha3Code, isoNumeric, isoName)

var countries = new CountryCollection();
countries.Add("ZZ", "ZZZ", 999, "New Country");

instance.Remove(code)

var code = "ZZ";
var countries = new CountryCollection();
countries.Remove(code);

Update CountryInfo.Name and CountryInfo.FullName

string code = "US";
var country = new CountryCollection[code];

country.Name = "UNITED STATES";
country.FullName = "UNITED STATES OF AMERICA";
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 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 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
1.1.0 429 11/19/2021
1.0.1 352 11/14/2021
1.0.0 369 11/14/2021

* Added full names
* Added device-agonostic (general) names
* Added indexer for getting the country by code
* Added static enumeration (.Values)
* Made all non-ISO names user-editable