The Country Code Library provides a collection of two-letter and three-letter country codes according to the ISO 3166-1 standard, as well as it provides USA, China and Canada Province codes (State codes / adminstrative division codes). In addition, it includes telephone calling codes, currency codes, currency Symbols for countries across the world. This library can be accessed with ease through static fields by any .NET framework.
$ dotnet add package CountryCodesLibThe Country Codes Library provides a collection of two-letter and three-letter country codes according to the ISO 3166-1 standard.
To install the Country Codes Library, use the NuGet package manager in Visual Studio or run the following command in the Package Manager Console:
Install-Package CountryCodesLib
After installing the Country Codes Library, you can use it in your project to retrieve two letter and three letter country codes. Here are some examples:
using CountryCodes;
Console.WriteLine($"USA's Two Letter Country Code is {TwoLetterISORegionCode.UnitedStates}");
Console.WriteLine($"India's Three letter Country Code is {ThreeLetterISORegionCode.India}");
USA's Two Letter Country Code is US
India's Three letter Country Code is IND