.NET Country Data Lib
Find a file
2023-12-24 15:47:44 +01:00
src/Nyanbyte.Countries Docs, MIT, initial prerelease 2023-12-24 15:47:44 +01:00
.gitignore Add dataset, create populating script 2023-12-24 00:47:53 +01:00
Countries.sln init 2023-10-11 22:15:27 +02:00
countrydata.csv Add dataset, create populating script 2023-12-24 00:47:53 +01:00
LICENSE.txt Docs, MIT, initial prerelease 2023-12-24 15:47:44 +01:00
populate.sh Add dataset, create populating script 2023-12-24 00:47:53 +01:00
README.md Docs, MIT, initial prerelease 2023-12-24 15:47:44 +01:00

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:

  • GetFromName
  • GetByCurrency(string)
  • GetByCurrency(int)
  • GetFromCallingCode
  • GetFromTld

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);