A comprehensive .NET library for accessing detailed country information. Features include retrieving country details such as names, codes, capitals, continents, population, and area. Perfect for applications needing geographical data, international business logic, or educational purposes.
$ dotnet add package CountriesInfoA comprehensive multi-language library for accessing detailed country information. Available for multiple platforms and languages.
npm install @mohaned.ghawar/countries-info
pip install countries-info-mg
composer require mohanedghawar/countries-info
dotnet add package CountriesInfo
Each country object contains:
Each city object contains:
const { getAllCountries, getCountryByName, getCountryByCode, getCountryRegions } = require('@mohaned.ghawar/countries-info');
// Get all countries
const countries = getAllCountries();
// Get country by name
const france = getCountryByName('France');
// Get country by code
const usa = getCountryByCode('USA');
// Get country regions
const usaRegions = getCountryRegions('USA'); // Returns all US statesfrom countries_info import get_all_countries, get_country_by_name, get_country_by_code, get_country_regions
# Get all countries
countries = get_all_countries()
# Get country by name
france = get_country_by_name('France')
# Get country by code
usa = get_country_by_code('USA')
# Get country regions
usa_regions = get_country_regions('USA') # Returns all US statesuse MohanedGhawar\CountriesInfo\CountriesInfo;
$countriesInfo = new CountriesInfo();
// Get all countries
$countries = $countriesInfo->getAllCountries();
// Get country by name
$france = $countriesInfo->getCountryByName('France');
// Get country by code
$usa = $countriesInfo->getCountryByCode('USA');
// Get country regions
$usaRegions = $countriesInfo->getCountryRegions('USA'); // Returns all US statesusing CountriesInfo;
var service = new CountriesService();
// Get basic country information
var countries = service.GetAllCountries();
var usa = service.GetCountryByCode("USA");
// Get regions (states/provinces)
var regions = service.GetRegionsByCountryCode("USA"); // Returns all US states
var hasRegions = service.HasRegions("USA"); // Check if country has regions
// Get cities information
var californiaCities = service.GetCitiesByRegion("USA", "California"); // Get all cities in California
var allUsCities = service.GetAllCitiesInCountry("USA"); // Get all cities in the USA
var cityCount = service.GetCityCount("USA"); // Get total number of cities in the USA
// Example of working with city data
foreach (var city in californiaCities)
{
Console.WriteLine($"City: {city.Name}");
Console.WriteLine($"Population: {city.Population}");
Console.WriteLine($"Location: {city.Latitude}, {city.Longitude}");
}Detailed documentation for each platform:
MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
If you encounter any issues or have questions, please file an issue on the appropriate GitHub repository: