|
1 | | -# Nager.Country |
| 1 | +# 🌍 Nager.Country – Worldwide Country Information |
2 | 2 |
|
3 | | -The Worldwirde Country Informations are available over the nuget package. The collection contains the Informations for 250 Countries. |
| 3 | +**Nager.Country** provides a comprehensive dataset of **worldwide country information**, designed for developers who need reliable and structured country-related data. |
| 4 | + |
| 5 | +The dataset includes **250 countries and territories** with detailed information such as: |
| 6 | + |
| 7 | +- ✅ Official country names |
| 8 | +- 🌐 ISO 3166 Alpha-2, Alpha-3, and numeric country codes |
| 9 | +- 💱 Associated currencies and ISO 4217 currency codes |
| 10 | +- 🗣️ Official and spoken languages (ISO 639) |
| 11 | +- 🌍 Continent and subregion classification |
| 12 | +- 🌐 Country borders |
| 13 | +- 🌏 Translations in multiple languages |
| 14 | + |
| 15 | +## 🌐 Optional Package – `Nager.Country.Translation` |
4 | 16 |
|
5 | 17 | > If you need the translations of the countries you will find in the further nuget package [Nager.Country.Translation](https://www.nuget.org/packages/Nager.Country.Translation) |
6 | 18 |
|
7 | 19 | ## Code Examples |
8 | 20 |
|
9 | | -### Get CountryInfo - Germany via Alpha2Code |
10 | | - |
11 | | - ICountryProvider countryProvider = new CountryProvider(); |
12 | | - var countryInfo = countryProvider.GetCountry(Alpha2Code.DE); |
13 | | - //countryInfo.CommonName -> Germany |
14 | | - //countryInfo.Alpha3Code -> DEU |
15 | | - //countryInfo.NumericCode -> 276 |
16 | | - //countryInfo.Region -> Europe |
17 | | - //countryInfo.SubRegion -> WesternEurope |
18 | | - //countryInfo... |
19 | | - |
20 | | -### Get CountryInfo - Germany via CommonName |
21 | | - |
22 | | - ICountryProvider countryProvider = new CountryProvider(); |
23 | | - var countryInfo = countryProvider.GetCountryByName("Germany"); |
24 | | - //countryInfo.Alpha2Code -> DE |
25 | | - //countryInfo.Alpha3Code -> DEU |
26 | | - //countryInfo.NumericCode -> 276 |
27 | | - //countryInfo.Region -> Europe |
28 | | - //countryInfo.SubRegion -> WesternEurope |
29 | | - //countryInfo.. |
| 21 | +### Get CountryInfo for Germany via ISO-3166-1 Alpha-2 |
| 22 | +══════════════════════════════════════════════════════════════════════════════════════════════════════ |
| 23 | + |
| 24 | +```cs |
| 25 | +ICountryProvider countryProvider = new CountryProvider(); |
| 26 | +var countryInfo = countryProvider.GetCountry("de"); |
| 27 | +//countryInfo.CommonName -> Germany |
| 28 | +//countryInfo.Alpha3Code -> DEU |
| 29 | +//countryInfo.NumericCode -> 276 |
| 30 | +//countryInfo.Region -> Europe |
| 31 | +//countryInfo.SubRegion -> WesternEurope |
| 32 | +//countryInfo... |
| 33 | +``` |
| 34 | + |
| 35 | +### Get CountryInfo for Germany via Alpha2Code |
| 36 | + |
| 37 | +```cs |
| 38 | +ICountryProvider countryProvider = new CountryProvider(); |
| 39 | +var countryInfo = countryProvider.GetCountry(Alpha2Code.DE); |
| 40 | +//countryInfo.CommonName -> Germany |
| 41 | +//countryInfo.Alpha3Code -> DEU |
| 42 | +//countryInfo.NumericCode -> 276 |
| 43 | +//countryInfo.Region -> Europe |
| 44 | +//countryInfo.SubRegion -> WesternEurope |
| 45 | +//countryInfo... |
| 46 | +``` |
| 47 | + |
| 48 | +### Get CountryInfo for Germany via CommonName |
| 49 | + |
| 50 | +```cs |
| 51 | +ICountryProvider countryProvider = new CountryProvider(); |
| 52 | +var countryInfo = countryProvider.GetCountryByName("Germany"); |
| 53 | +//countryInfo.Alpha2Code -> DE |
| 54 | +//countryInfo.Alpha3Code -> DEU |
| 55 | +//countryInfo.NumericCode -> 276 |
| 56 | +//countryInfo.Region -> Europe |
| 57 | +//countryInfo.SubRegion -> WesternEurope |
| 58 | +//countryInfo.. |
| 59 | +``` |
| 60 | + |
| 61 | +### Get all available countries |
| 62 | + |
| 63 | +Retrieve a full list of all 250 countries and territories. |
| 64 | + |
| 65 | +```cs |
| 66 | +var countryProvider = new CountryProvider(); |
| 67 | +var countries = countryProvider.GetCountries(); |
| 68 | +``` |
0 commit comments