Get a Continental Continent in C #

Is there a way to find the continent of a country in C # using the RegionInfo class or any other way?

For example, you give the name of the country "Denmark", and it returns "Europe".

+6
c #
source share
6 answers

You can save the hash table. The records will indicate the name of the country and the meaning of the name of the continent. Just create this table from some shared database, and as soon as you get it, you can simply query it. It is also pretty fast.

http://www.geonames.org/countries/
You can get a database from there (it is possible to load / export)

+3
source share

Nothing like that in the .NET platform. It is also rather ambiguous with geographical definitions for Eurasia and Oceania. There are 6 different definitions . You will need your dbase.

+7
source share

There are only a few continents and only a few hundred countries, so it would not be easy to just build your own table. There are differences of opinion as to what the continents are (Australia / Oceania / Australasia / Asia, in particular, prickly at times) and, for example, Turkey and Russia are in Europe, Asia, or both. However, renting your own, at least, allows you to make your own call on these issues.

+2
source share

RegionInfo does not store the continent. But you can create a database using GeoNames.org Country Information . The data format is utf8-encoded tabulation text. It has all the information and much more that you need.

0
source share

I know this is an old question, but I created a library for C # and it contains information about continents. You can find my project here. Nager The country. I hope he helps you.

install-package Nager.Country is also available install-package Nager.Country

example

 ICountryProvider countryProvider = new CountryProvider(); var countryInfo = countryProvider.GetCountry(Alpha2Code.DK); 
0
source share

All Articles