.NET Country Data Lib
- C# 97.2%
- Shell 2.8%
| src/Nyanbyte.Countries | ||
| .gitignore | ||
| Countries.sln | ||
| countrydata.csv | ||
| LICENSE.txt | ||
| populate.sh | ||
| README.md | ||
Nyanbyte.Countries
A .NET library for country data, including ISO Codes, currencies, and other data associated with countries.
Usage
Fixed countries by ISO 3166-1 alpha2 code enums
using Nyanbyte.Countries;
Country pl = CountryCodes.PL.GetCountry();
// use the object
Console.WriteLine(pl.OfficialName == "Poland");
or
using Nyanbyte.Countries;
Country pl = Country.GetFromCode(CountryCodes.PL);
// use the object
Console.WriteLine(pl.OfficialName == "Poland");
Querying by data
The methods:
GetFromNameGetByCurrency(string)GetByCurrency(int)GetFromCallingCodeGetFromTld
do not guarantee results due to potential invalid input. Therefore validation is required.
using Nyanbyte.Countries;
Country? country = Country.GetFromCallingCode(48);
if(country is null)
{
//handle invalid result
return;
}
// use the object otherwise
Console.WriteLine(pl.OfficialName);