https://github.com/erossini/csharpcountrydata
A simple cross platform offline .NET library for getting country data.
https://github.com/erossini/csharpcountrydata
countries countries-api country-codes country-data country-list csharp
Last synced: 23 days ago
JSON representation
A simple cross platform offline .NET library for getting country data.
- Host: GitHub
- URL: https://github.com/erossini/csharpcountrydata
- Owner: erossini
- License: mit
- Created: 2024-06-18T08:58:35.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-16T10:32:34.000Z (almost 2 years ago)
- Last Synced: 2025-02-22T21:51:26.537Z (over 1 year ago)
- Topics: countries, countries-api, country-codes, country-data, country-list, csharp
- Language: C#
- Homepage: https://puresourcecode.com/dotnet/net8/country-data-library-for-net8/
- Size: 1.39 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Country Data library for NET8

A simple cross-platform offline .NET library for getting country data. The library is based on the ISO-3166-1 standard.
Based on the operating system, using *Unicode*, you can display the flag of the country. On Windows, the _emoji_ displays the shortcode of the country, not the flag.
The library has the flags of the countries in SVG format. The flags can be displayed in two different types: `Square` and `Wide`.
## Install Library
To install the library in your project, open the *Package Manager* and type the following command:
```cSharp
Install-Package PSC.CSharp.Library.CountryData
```
Also, you can use the .NET CLI to install the library. Type the following command:
```cSharp
dotnet add package PSC.CSharp.Library.CountryData
```
## Usage
Here is an example how to use the library in your project.
### Initialize the CountryData
```cSharp
// loads all Country Data via the constructor (You can initialize this once as a singleton)
var countryHelper = new CountryHelper();
```
### Get the list of countries
```cSharp
foreach (var country in countries)
Console.WriteLine(country);
```
### Get the list of regions in a country by country code
```cSharp
var regions = countryHelper.GetRegionByCountryCode("IT");
foreach (var region in regions)
Console.WriteLine(region.Name);
```
### Using lambda for custom queries
`GetCountryData()` returns an `IEnumerable` which can be queried with Lambda for a more flexible usage.
```cSharp
var data = countryHelper.GetCountryData();
```
### Get the list of countries by their Names
This code displays the name of the countries using a `foreach`.
```cSharp
var countries = data.Select(c => c.CountryName).ToList();
foreach (var country in countries)
Console.WriteLine(country);
```
Here the code to use `Linq` to filter the list.
```cSharp
data.Where(x => x.CountryShortCode == "US")
.Select(r=>r.Regions).FirstOrDefault()
.ToList();
```
### Get the flag for a country
In the library, I added a method to get the flag of a country. The flags are in SVG format. The type of the flag can be `Square` or `Wide`.
```cSharp
var flag = helper.GetFlagByCountryCode("GB", FlagType.Square);
```
## List of supported ISO-3166-1 country codes
Here is the list of supported ISO-3166-1 country codes, their code point pairs and `Emoji` flags. Based on the operating system, you see different _Emoji_.
In Windows, you see the short name of the country. In iOS and Android, the flag of the correspondent country is displayed.
| ISO | Emoji | Unicode | Name |
|-----|-------|-----------------|----------------------------------------------|
| AD | ๐ฆ๐ฉ | U+1F1E6 U+1F1E9 | Andorra |
| AE | ๐ฆ๐ช | U+1F1E6 U+1F1EA | United Arab Emirates |
| AF | ๐ฆ๐ซ | U+1F1E6 U+1F1EB | Afghanistan |
| AG | ๐ฆ๐ฌ | U+1F1E6 U+1F1EC | Antigua and Barbuda |
| AI | ๐ฆ๐ฎ | U+1F1E6 U+1F1EE | Anguilla |
| AL | ๐ฆ๐ฑ | U+1F1E6 U+1F1F1 | Albania |
| AM | ๐ฆ๐ฒ | U+1F1E6 U+1F1F2 | Armenia |
| AO | ๐ฆ๐ด | U+1F1E6 U+1F1F4 | Angola |
| AQ | ๐ฆ๐ถ | U+1F1E6 U+1F1F6 | Antarctica |
| AR | ๐ฆ๐ท | U+1F1E6 U+1F1F7 | Argentina |
| AS | ๐ฆ๐ธ | U+1F1E6 U+1F1F8 | American Samoa |
| AT | ๐ฆ๐น | U+1F1E6 U+1F1F9 | Austria |
| AU | ๐ฆ๐บ | U+1F1E6 U+1F1FA | Australia |
| AW | ๐ฆ๐ผ | U+1F1E6 U+1F1FC | Aruba |
| AX | ๐ฆ๐ฝ | U+1F1E6 U+1F1FD | ร
land Islands |
| AZ | ๐ฆ๐ฟ | U+1F1E6 U+1F1FF | Azerbaijan |
| BA | ๐ง๐ฆ | U+1F1E7 U+1F1E6 | Bosnia and Herzegovina |
| BB | ๐ง๐ง | U+1F1E7 U+1F1E7 | Barbados |
| BD | ๐ง๐ฉ | U+1F1E7 U+1F1E9 | Bangladesh |
| BE | ๐ง๐ช | U+1F1E7 U+1F1EA | Belgium |
| BF | ๐ง๐ซ | U+1F1E7 U+1F1EB | Burkina Faso |
| BG | ๐ง๐ฌ | U+1F1E7 U+1F1EC | Bulgaria |
| BH | ๐ง๐ญ | U+1F1E7 U+1F1ED | Bahrain |
| BI | ๐ง๐ฎ | U+1F1E7 U+1F1EE | Burundi |
| BJ | ๐ง๐ฏ | U+1F1E7 U+1F1EF | Benin |
| BL | ๐ง๐ฑ | U+1F1E7 U+1F1F1 | Saint Barthรฉlemy |
| BM | ๐ง๐ฒ | U+1F1E7 U+1F1F2 | Bermuda |
| BN | ๐ง๐ณ | U+1F1E7 U+1F1F3 | Brunei Darussalam |
| BO | ๐ง๐ด | U+1F1E7 U+1F1F4 | Bolivia |
| BQ | ๐ง๐ถ | U+1F1E7 U+1F1F6 | Bonaire, Sint Eustatius and Saba |
| BR | ๐ง๐ท | U+1F1E7 U+1F1F7 | Brazil |
| BS | ๐ง๐ธ | U+1F1E7 U+1F1F8 | Bahamas |
| BT | ๐ง๐น | U+1F1E7 U+1F1F9 | Bhutan |
| BV | ๐ง๐ป | U+1F1E7 U+1F1FB | Bouvet Island |
| BW | ๐ง๐ผ | U+1F1E7 U+1F1FC | Botswana |
| BY | ๐ง๐พ | U+1F1E7 U+1F1FE | Belarus |
| BZ | ๐ง๐ฟ | U+1F1E7 U+1F1FF | Belize |
| CA | ๐จ๐ฆ | U+1F1E8 U+1F1E6 | Canada |
| CC | ๐จ๐จ | U+1F1E8 U+1F1E8 | Cocos (Keeling) Islands |
| CD | ๐จ๐ฉ | U+1F1E8 U+1F1E9 | Congo |
| CF | ๐จ๐ซ | U+1F1E8 U+1F1EB | Central African Republic |
| CG | ๐จ๐ฌ | U+1F1E8 U+1F1EC | Congo |
| CH | ๐จ๐ญ | U+1F1E8 U+1F1ED | Switzerland |
| CI | ๐จ๐ฎ | U+1F1E8 U+1F1EE | Cรดte D'Ivoire |
| CK | ๐จ๐ฐ | U+1F1E8 U+1F1F0 | Cook Islands |
| CL | ๐จ๐ฑ | U+1F1E8 U+1F1F1 | Chile |
| CM | ๐จ๐ฒ | U+1F1E8 U+1F1F2 | Cameroon |
| CN | ๐จ๐ณ | U+1F1E8 U+1F1F3 | China |
| CO | ๐จ๐ด | U+1F1E8 U+1F1F4 | Colombia |
| CR | ๐จ๐ท | U+1F1E8 U+1F1F7 | Costa Rica |
| CU | ๐จ๐บ | U+1F1E8 U+1F1FA | Cuba |
| CV | ๐จ๐ป | U+1F1E8 U+1F1FB | Cape Verde |
| CW | ๐จ๐ผ | U+1F1E8 U+1F1FC | Curaรงao |
| CX | ๐จ๐ฝ | U+1F1E8 U+1F1FD | Christmas Island |
| CY | ๐จ๐พ | U+1F1E8 U+1F1FE | Cyprus |
| CZ | ๐จ๐ฟ | U+1F1E8 U+1F1FF | Czech Republic |
| DE | ๐ฉ๐ช | U+1F1E9 U+1F1EA | Germany |
| DJ | ๐ฉ๐ฏ | U+1F1E9 U+1F1EF | Djibouti |
| DK | ๐ฉ๐ฐ | U+1F1E9 U+1F1F0 | Denmark |
| DM | ๐ฉ๐ฒ | U+1F1E9 U+1F1F2 | Dominica |
| DO | ๐ฉ๐ด | U+1F1E9 U+1F1F4 | Dominican Republic |
| DZ | ๐ฉ๐ฟ | U+1F1E9 U+1F1FF | Algeria |
| EC | ๐ช๐จ | U+1F1EA U+1F1E8 | Ecuador |
| EE | ๐ช๐ช | U+1F1EA U+1F1EA | Estonia |
| EG | ๐ช๐ฌ | U+1F1EA U+1F1EC | Egypt |
| EH | ๐ช๐ญ | U+1F1EA U+1F1ED | Western Sahara |
| ER | ๐ช๐ท | U+1F1EA U+1F1F7 | Eritrea |
| ES | ๐ช๐ธ | U+1F1EA U+1F1F8 | Spain |
| ET | ๐ช๐น | U+1F1EA U+1F1F9 | Ethiopia |
| FI | ๐ซ๐ฎ | U+1F1EB U+1F1EE | Finland |
| FJ | ๐ซ๐ฏ | U+1F1EB U+1F1EF | Fiji |
| FK | ๐ซ๐ฐ | U+1F1EB U+1F1F0 | Falkland Islands (Malvinas) |
| FM | ๐ซ๐ฒ | U+1F1EB U+1F1F2 | Micronesia |
| FO | ๐ซ๐ด | U+1F1EB U+1F1F4 | Faroe Islands |
| FR | ๐ซ๐ท | U+1F1EB U+1F1F7 | France |
| GA | ๐ฌ๐ฆ | U+1F1EC U+1F1E6 | Gabon |
| GB | ๐ฌ๐ง | U+1F1EC U+1F1E7 | United Kingdom |
| GD | ๐ฌ๐ฉ | U+1F1EC U+1F1E9 | Grenada |
| GE | ๐ฌ๐ช | U+1F1EC U+1F1EA | Georgia |
| GF | ๐ฌ๐ซ | U+1F1EC U+1F1EB | French Guiana |
| GG | ๐ฌ๐ฌ | U+1F1EC U+1F1EC | Guernsey |
| GH | ๐ฌ๐ญ | U+1F1EC U+1F1ED | Ghana |
| GI | ๐ฌ๐ฎ | U+1F1EC U+1F1EE | Gibraltar |
| GL | ๐ฌ๐ฑ | U+1F1EC U+1F1F1 | Greenland |
| GM | ๐ฌ๐ฒ | U+1F1EC U+1F1F2 | Gambia |
| GN | ๐ฌ๐ณ | U+1F1EC U+1F1F3 | Guinea |
| GP | ๐ฌ๐ต | U+1F1EC U+1F1F5 | Guadeloupe |
| GQ | ๐ฌ๐ถ | U+1F1EC U+1F1F6 | Equatorial Guinea |
| GR | ๐ฌ๐ท | U+1F1EC U+1F1F7 | Greece |
| GS | ๐ฌ๐ธ | U+1F1EC U+1F1F8 | South Georgia |
| GT | ๐ฌ๐น | U+1F1EC U+1F1F9 | Guatemala |
| GU | ๐ฌ๐บ | U+1F1EC U+1F1FA | Guam |
| GW | ๐ฌ๐ผ | U+1F1EC U+1F1FC | Guinea-Bissau |
| GY | ๐ฌ๐พ | U+1F1EC U+1F1FE | Guyana |
| HK | ๐ญ๐ฐ | U+1F1ED U+1F1F0 | Hong Kong |
| HM | ๐ญ๐ฒ | U+1F1ED U+1F1F2 | Heard Island and Mcdonald Islands |
| HN | ๐ญ๐ณ | U+1F1ED U+1F1F3 | Honduras |
| HR | ๐ญ๐ท | U+1F1ED U+1F1F7 | Croatia |
| HT | ๐ญ๐น | U+1F1ED U+1F1F9 | Haiti |
| HU | ๐ญ๐บ | U+1F1ED U+1F1FA | Hungary |
| ID | ๐ฎ๐ฉ | U+1F1EE U+1F1E9 | Indonesia |
| IE | ๐ฎ๐ช | U+1F1EE U+1F1EA | Ireland |
| IL | ๐ฎ๐ฑ | U+1F1EE U+1F1F1 | Israel |
| IM | ๐ฎ๐ฒ | U+1F1EE U+1F1F2 | Isle of Man |
| IN | ๐ฎ๐ณ | U+1F1EE U+1F1F3 | India |
| IO | ๐ฎ๐ด | U+1F1EE U+1F1F4 | British Indian Ocean Territory |
| IQ | ๐ฎ๐ถ | U+1F1EE U+1F1F6 | Iraq |
| IR | ๐ฎ๐ท | U+1F1EE U+1F1F7 | Iran |
| IS | ๐ฎ๐ธ | U+1F1EE U+1F1F8 | Iceland |
| IT | ๐ฎ๐น | U+1F1EE U+1F1F9 | Italy |
| JE | ๐ฏ๐ช | U+1F1EF U+1F1EA | Jersey |
| JM | ๐ฏ๐ฒ | U+1F1EF U+1F1F2 | Jamaica |
| JO | ๐ฏ๐ด | U+1F1EF U+1F1F4 | Jordan |
| JP | ๐ฏ๐ต | U+1F1EF U+1F1F5 | Japan |
| KE | ๐ฐ๐ช | U+1F1F0 U+1F1EA | Kenya |
| KG | ๐ฐ๐ฌ | U+1F1F0 U+1F1EC | Kyrgyzstan |
| KH | ๐ฐ๐ญ | U+1F1F0 U+1F1ED | Cambodia |
| KI | ๐ฐ๐ฎ | U+1F1F0 U+1F1EE | Kiribati |
| KM | ๐ฐ๐ฒ | U+1F1F0 U+1F1F2 | Comoros |
| KN | ๐ฐ๐ณ | U+1F1F0 U+1F1F3 | Saint Kitts and Nevis |
| KP | ๐ฐ๐ต | U+1F1F0 U+1F1F5 | North Korea |
| KR | ๐ฐ๐ท | U+1F1F0 U+1F1F7 | South Korea |
| KW | ๐ฐ๐ผ | U+1F1F0 U+1F1FC | Kuwait |
| KY | ๐ฐ๐พ | U+1F1F0 U+1F1FE | Cayman Islands |
| KZ | ๐ฐ๐ฟ | U+1F1F0 U+1F1FF | Kazakhstan |
| LA | ๐ฑ๐ฆ | U+1F1F1 U+1F1E6 | Lao People's Democratic Republic |
| LB | ๐ฑ๐ง | U+1F1F1 U+1F1E7 | Lebanon |
| LC | ๐ฑ๐จ | U+1F1F1 U+1F1E8 | Saint Lucia |
| LI | ๐ฑ๐ฎ | U+1F1F1 U+1F1EE | Liechtenstein |
| LK | ๐ฑ๐ฐ | U+1F1F1 U+1F1F0 | Sri Lanka |
| LR | ๐ฑ๐ท | U+1F1F1 U+1F1F7 | Liberia |
| LS | ๐ฑ๐ธ | U+1F1F1 U+1F1F8 | Lesotho |
| LT | ๐ฑ๐น | U+1F1F1 U+1F1F9 | Lithuania |
| LU | ๐ฑ๐บ | U+1F1F1 U+1F1FA | Luxembourg |
| LV | ๐ฑ๐ป | U+1F1F1 U+1F1FB | Latvia |
| LY | ๐ฑ๐พ | U+1F1F1 U+1F1FE | Libya |
| MA | ๐ฒ๐ฆ | U+1F1F2 U+1F1E6 | Morocco |
| MC | ๐ฒ๐จ | U+1F1F2 U+1F1E8 | Monaco |
| MD | ๐ฒ๐ฉ | U+1F1F2 U+1F1E9 | Moldova |
| ME | ๐ฒ๐ช | U+1F1F2 U+1F1EA | Montenegro |
| MF | ๐ฒ๐ซ | U+1F1F2 U+1F1EB | Saint Martin (French Part) |
| MG | ๐ฒ๐ฌ | U+1F1F2 U+1F1EC | Madagascar |
| MH | ๐ฒ๐ญ | U+1F1F2 U+1F1ED | Marshall Islands |
| MK | ๐ฒ๐ฐ | U+1F1F2 U+1F1F0 | Macedonia |
| ML | ๐ฒ๐ฑ | U+1F1F2 U+1F1F1 | Mali |
| MM | ๐ฒ๐ฒ | U+1F1F2 U+1F1F2 | Myanmar |
| MN | ๐ฒ๐ณ | U+1F1F2 U+1F1F3 | Mongolia |
| MO | ๐ฒ๐ด | U+1F1F2 U+1F1F4 | Macao |
| MP | ๐ฒ๐ต | U+1F1F2 U+1F1F5 | Northern Mariana Islands |
| MQ | ๐ฒ๐ถ | U+1F1F2 U+1F1F6 | Martinique |
| MR | ๐ฒ๐ท | U+1F1F2 U+1F1F7 | Mauritania |
| MS | ๐ฒ๐ธ | U+1F1F2 U+1F1F8 | Montserrat |
| MT | ๐ฒ๐น | U+1F1F2 U+1F1F9 | Malta |
| MU | ๐ฒ๐บ | U+1F1F2 U+1F1FA | Mauritius |
| MV | ๐ฒ๐ป | U+1F1F2 U+1F1FB | Maldives |
| MW | ๐ฒ๐ผ | U+1F1F2 U+1F1FC | Malawi |
| MX | ๐ฒ๐ฝ | U+1F1F2 U+1F1FD | Mexico |
| MY | ๐ฒ๐พ | U+1F1F2 U+1F1FE | Malaysia |
| MZ | ๐ฒ๐ฟ | U+1F1F2 U+1F1FF | Mozambique |
| NA | ๐ณ๐ฆ | U+1F1F3 U+1F1E6 | Namibia |
| NC | ๐ณ๐จ | U+1F1F3 U+1F1E8 | New Caledonia |
| NE | ๐ณ๐ช | U+1F1F3 U+1F1EA | Niger |
| NF | ๐ณ๐ซ | U+1F1F3 U+1F1EB | Norfolk Island |
| NG | ๐ณ๐ฌ | U+1F1F3 U+1F1EC | Nigeria |
| NI | ๐ณ๐ฎ | U+1F1F3 U+1F1EE | Nicaragua |
| NL | ๐ณ๐ฑ | U+1F1F3 U+1F1F1 | Netherlands |
| NO | ๐ณ๐ด | U+1F1F3 U+1F1F4 | Norway |
| NP | ๐ณ๐ต | U+1F1F3 U+1F1F5 | Nepal |
| NR | ๐ณ๐ท | U+1F1F3 U+1F1F7 | Nauru |
| NU | ๐ณ๐บ | U+1F1F3 U+1F1FA | Niue |
| NZ | ๐ณ๐ฟ | U+1F1F3 U+1F1FF | New Zealand |
| OM | ๐ด๐ฒ | U+1F1F4 U+1F1F2 | Oman |
| PA | ๐ต๐ฆ | U+1F1F5 U+1F1E6 | Panama |
| PE | ๐ต๐ช | U+1F1F5 U+1F1EA | Peru |
| PF | ๐ต๐ซ | U+1F1F5 U+1F1EB | French Polynesia |
| PG | ๐ต๐ฌ | U+1F1F5 U+1F1EC | Papua New Guinea |
| PH | ๐ต๐ญ | U+1F1F5 U+1F1ED | Philippines |
| PK | ๐ต๐ฐ | U+1F1F5 U+1F1F0 | Pakistan |
| PL | ๐ต๐ฑ | U+1F1F5 U+1F1F1 | Poland |
| PM | ๐ต๐ฒ | U+1F1F5 U+1F1F2 | Saint Pierre and Miquelon |
| PN | ๐ต๐ณ | U+1F1F5 U+1F1F3 | Pitcairn |
| PR | ๐ต๐ท | U+1F1F5 U+1F1F7 | Puerto Rico |
| PS | ๐ต๐ธ | U+1F1F5 U+1F1F8 | Palestinian Territory |
| PT | ๐ต๐น | U+1F1F5 U+1F1F9 | Portugal |
| PW | ๐ต๐ผ | U+1F1F5 U+1F1FC | Palau |
| PY | ๐ต๐พ | U+1F1F5 U+1F1FE | Paraguay |
| QA | ๐ถ๐ฆ | U+1F1F6 U+1F1E6 | Qatar |
| RE | ๐ท๐ช | U+1F1F7 U+1F1EA | Rรฉunion |
| RO | ๐ท๐ด | U+1F1F7 U+1F1F4 | Romania |
| RS | ๐ท๐ธ | U+1F1F7 U+1F1F8 | Serbia |
| RU | ๐ท๐บ | U+1F1F7 U+1F1FA | Russia |
| RW | ๐ท๐ผ | U+1F1F7 U+1F1FC | Rwanda |
| SA | ๐ธ๐ฆ | U+1F1F8 U+1F1E6 | Saudi Arabia |
| SB | ๐ธ๐ง | U+1F1F8 U+1F1E7 | Solomon Islands |
| SC | ๐ธ๐จ | U+1F1F8 U+1F1E8 | Seychelles |
| SD | ๐ธ๐ฉ | U+1F1F8 U+1F1E9 | Sudan |
| SE | ๐ธ๐ช | U+1F1F8 U+1F1EA | Sweden |
| SG | ๐ธ๐ฌ | U+1F1F8 U+1F1EC | Singapore |
| SH | ๐ธ๐ญ | U+1F1F8 U+1F1ED | Saint Helena, Ascension and Tristan Da Cunha |
| SI | ๐ธ๐ฎ | U+1F1F8 U+1F1EE | Slovenia |
| SJ | ๐ธ๐ฏ | U+1F1F8 U+1F1EF | Svalbard and Jan Mayen |
| SK | ๐ธ๐ฐ | U+1F1F8 U+1F1F0 | Slovakia |
| SL | ๐ธ๐ฑ | U+1F1F8 U+1F1F1 | Sierra Leone |
| SM | ๐ธ๐ฒ | U+1F1F8 U+1F1F2 | San Marino |
| SN | ๐ธ๐ณ | U+1F1F8 U+1F1F3 | Senegal |
| SO | ๐ธ๐ด | U+1F1F8 U+1F1F4 | Somalia |
| SR | ๐ธ๐ท | U+1F1F8 U+1F1F7 | Suriname |
| SS | ๐ธ๐ธ | U+1F1F8 U+1F1F8 | South Sudan |
| ST | ๐ธ๐น | U+1F1F8 U+1F1F9 | Sao Tome and Principe |
| SV | ๐ธ๐ป | U+1F1F8 U+1F1FB | El Salvador |
| SX | ๐ธ๐ฝ | U+1F1F8 U+1F1FD | Sint Maarten (Dutch Part) |
| SY | ๐ธ๐พ | U+1F1F8 U+1F1FE | Syrian Arab Republic |
| SZ | ๐ธ๐ฟ | U+1F1F8 U+1F1FF | Swaziland |
| TC | ๐น๐จ | U+1F1F9 U+1F1E8 | Turks and Caicos Islands |
| TD | ๐น๐ฉ | U+1F1F9 U+1F1E9 | Chad |
| TF | ๐น๐ซ | U+1F1F9 U+1F1EB | French Southern Territories |
| TG | ๐น๐ฌ | U+1F1F9 U+1F1EC | Togo |
| TH | ๐น๐ญ | U+1F1F9 U+1F1ED | Thailand |
| TJ | ๐น๐ฏ | U+1F1F9 U+1F1EF | Tajikistan |
| TK | ๐น๐ฐ | U+1F1F9 U+1F1F0 | Tokelau |
| TL | ๐น๐ฑ | U+1F1F9 U+1F1F1 | Timor-Leste |
| TM | ๐น๐ฒ | U+1F1F9 U+1F1F2 | Turkmenistan |
| TN | ๐น๐ณ | U+1F1F9 U+1F1F3 | Tunisia |
| TO | ๐น๐ด | U+1F1F9 U+1F1F4 | Tonga |
| TR | ๐น๐ท | U+1F1F9 U+1F1F7 | Turkey |
| TT | ๐น๐น | U+1F1F9 U+1F1F9 | Trinidad and Tobago |
| TV | ๐น๐ป | U+1F1F9 U+1F1FB | Tuvalu |
| TW | ๐น๐ผ | U+1F1F9 U+1F1FC | Taiwan |
| TZ | ๐น๐ฟ | U+1F1F9 U+1F1FF | Tanzania |
| UA | ๐บ๐ฆ | U+1F1FA U+1F1E6 | Ukraine |
| UG | ๐บ๐ฌ | U+1F1FA U+1F1EC | Uganda |
| UM | ๐บ๐ฒ | U+1F1FA U+1F1F2 | United States Minor Outlying Islands |
| US | ๐บ๐ธ | U+1F1FA U+1F1F8 | United States |
| UY | ๐บ๐พ | U+1F1FA U+1F1FE | Uruguay |
| UZ | ๐บ๐ฟ | U+1F1FA U+1F1FF | Uzbekistan |
| VA | ๐ป๐ฆ | U+1F1FB U+1F1E6 | Vatican City |
| VC | ๐ป๐จ | U+1F1FB U+1F1E8 | Saint Vincent and The Grenadines |
| VE | ๐ป๐ช | U+1F1FB U+1F1EA | Venezuela |
| VG | ๐ป๐ฌ | U+1F1FB U+1F1EC | Virgin Islands, British |
| VI | ๐ป๐ฎ | U+1F1FB U+1F1EE | Virgin Islands, U.S. |
| VN | ๐ป๐ณ | U+1F1FB U+1F1F3 | Viet Nam |
| VU | ๐ป๐บ | U+1F1FB U+1F1FA | Vanuatu |
| WF | ๐ผ๐ซ | U+1F1FC U+1F1EB | Wallis and Futuna |
| WS | ๐ผ๐ธ | U+1F1FC U+1F1F8 | Samoa |
| YE | ๐พ๐ช | U+1F1FE U+1F1EA | Yemen |
| YT | ๐พ๐น | U+1F1FE U+1F1F9 | Mayotte |
| ZA | ๐ฟ๐ฆ | U+1F1FF U+1F1E6 | South Africa |
| ZM | ๐ฟ๐ฒ | U+1F1FF U+1F1F2 | Zambia |
| ZW | ๐ฟ๐ผ | U+1F1FF U+1F1FC | Zimbabwe |
## Functions
| Function | Return | Description |
|------------------------|----------------------|-------------------------------------------------------------|
| GetCountries() | IEnumerable | Gets the list of all countries in the world |
| GetCountryByCode | Country | Returns a single Country Data by ShortCode |
| GetCountryData() | IEnumerable | Gets the list of all countries in the world with their data |
| GetCountryEmojiFlag | string | Returns the Emoji Flag of a country by ShortCode |
| GetRegionByCountryCode | List | Returns the Regions of a country by ShortCode |
| GetJsonData | string | Returns the JSON Data of all countries in the world |
### Flags
| Function | Return | Description |
|------------------------|----------------------|-------------------------------------------------------------|
| GetFlagByCountryCode | string | Returns the Flag of a country by ShortCode |
| GetFlagData | FlagModel | Return the `FlagModel` of one country by ShortCode |
| GetNameByCountryCode | string | Returns the Name of a country by ShortCode |
### Get a full SVG
The `GetFlagByCountryCode` returns only the content of the SVG file. What it doesn't have is the `XML` declaration and the `DOCTYPE` declaration.
If you want to get the full SVG file, you can use the `GetFullSVG` function in the `SVGFlags` static class.
```csharp
var svgFlag = SVGFlags.GetFullSVG(SVGFlags.lgbt_1, "300", "300");
```
---
## PureSourceCode.com
[PureSourceCode.com](https://www.puresourcecode.com/) is my personal blog where I publish posts about technologies and in particular source code and projects in [.NET](https://www.puresourcecode.com/category/dotnet/).
In the last few months, I created a lot of components for [Blazor WebAssembly](https://www.puresourcecode.com/tag/blazor-webassembly/) and [Blazor Server](https://www.puresourcecode.com/tag/blazor-server/).
My name is Enrico Rossini and you can contact me via:
- [Personal Twitter](https://twitter.com/erossiniuk)
- [LinkedIn](https://www.linkedin.com/in/rossiniuk)
- [Facebook](https://www.facebook.com/puresourcecode)
## Blazor Components
| Component name | Forum | NuGet | Website | Description |
|---|---|---|---|---|
| [AnchorLink]() | [Forum](https://puresourcecode.com/forum/anchorlink/) |  | | An anchor link is a web link that allows users to leapfrog to a specific point on a website page. It saves them the need to scroll and skim read and makes navigation easier. This component is for [Blazor WebAssembly](https://www.puresourcecode.com/tag/blazor-webassembly/) and [Blazor Server](https://www.puresourcecode.com/tag/blazor-server/) |
| [Autocomplete for Blazor](https://www.puresourcecode.com/dotnet/net-core/autocomplete-component-for-blazor/) | [Forum](https://www.puresourcecode.com/forum/autocomplete-blazor/) |  | | Simple and flexible autocomplete type-ahead functionality for [Blazor WebAssembly](https://www.puresourcecode.com/tag/blazor-webassembly/) and [Blazor Server](https://www.puresourcecode.com/tag/blazor-server/) |
| [Browser Detect for Blazor](https://www.puresourcecode.com/dotnet/blazor/browser-detect-component-for-blazor/) | [Forum](https://www.puresourcecode.com/forum/browser-detect-for-blazor/) |  | [Demo](https://browserdetect.puresourcecode.com) | Browser detect for Blazor WebAssembly and Blazor Server |
| [ChartJs for Blazor](https://www.puresourcecode.com/dotnet/blazor/blazor-component-for-chartjs/) | [Forum](https://www.puresourcecode.com/forum/chart-js-for-blazor/) |  | [Demo](https://chartjs.puresourcecode.com/) | Add beautiful graphs based on ChartJs in your Blazor application |
| [Clippy for Blazor](https://www.puresourcecode.com/dotnet/blazor/blazor-component-for-chartjs/) | [Forum](https://www.puresourcecode.com/forum/clippy/) |  | [Demo](https://clippy.puresourcecode.com/) | Do you miss Clippy? Here the implementation for Blazor |
| [CodeSnipper for Blazor](https://www.puresourcecode.com/dotnet/blazor/code-snippet-component-for-blazor/) | [Forum](https://www.puresourcecode.com/forum/codesnippet-for-blazor/) |  | | Add code snippet in your Blazor pages for 196 programming languages with 243 styles |
| [Copy To Clipboard](https://www.puresourcecode.com/dotnet/blazor/copy-to-clipboard-component-for-blazor/) | [Forum](https://www.puresourcecode.com/forum/copytoclipboard/) |  | | Add a button to copy text in the clipboard |
| [DataTable for Blazor](https://www.puresourcecode.com/dotnet/net-core/datatable-component-for-blazor/) | [Forum](https://www.puresourcecode.com/forum/forum/datatables/) |  | [Demo](https://datatable.puresourcecode.com/) | DataTable component for Blazor WebAssembly and Blazor Server |
| [Google Tag Manager]() | [Forum]() |  | [Demo](https://datatable.puresourcecode.com/) | Adds Google Tag Manager to the application and manages communication with GTM JavaScript (data layer). |
| [Icons and flags for Blazor](https://www.puresourcecode.com/forum/icons-and-flags-for-blazor/) | [Forum](https://www.puresourcecode.com/forum/icons-and-flags-for-blazor/) |  | | Library with a lot of SVG icons and SVG flags to use in your Razor pages |
| [ImageSelect for Blazor]() | [Forum](https://puresourcecode.com/forum/imageselect/) |  | | This is a Blazor component to display a dropdown list with images based on ms-Dropdown by Marghoob Suleman. This component is built with NET7 for [Blazor WebAssembly](https://www.puresourcecode.com/tag/blazor-webassembly/) and [Blazor Server](https://www.puresourcecode.com/tag/blazor-server/) |
| [Markdown editor for Blazor](https://www.puresourcecode.com/dotnet/blazor/markdown-editor-with-blazor/) | [Forum](https://www.puresourcecode.com/forum/forum/markdown-editor-for-blazor/) |  | [Demo](https://markdown.puresourcecode.com/) | This is a Markdown Editor for use in Blazor. It contains a live preview as well as an embeded help guide for users. |
| [Modal dialog for Blazor](https://www.puresourcecode.com/dotnet/blazor/modal-dialog-component-for-blazor/) | [Forum](https://www.puresourcecode.com/forum/forum/modal-dialog-for-blazor/) |  | | Simple Modal Dialog for Blazor WebAssembly |
| [Modal windows for Blazor](https://www.puresourcecode.com/dotnet/blazor/modal-dialog-component-for-blazor/) | [Forum](https://www.puresourcecode.com/forum/forum/modal-dialog-for-blazor/) |  | | Modal Windows for Blazor WebAssembly |
| [Quill for Blazor](https://www.puresourcecode.com/dotnet/blazor/create-a-blazor-component-for-quill/) | [Forum](https://www.puresourcecode.com/forum/forum/quill-for-blazor/) |  | | Quill Component is a custom reusable control that allows us to easily consume Quill and place multiple instances of it on a single page in our Blazor application |
| [ScrollTabs](https://www.puresourcecode.com/dotnet/blazor/scrolltabs-component-for-blazor/) | |  | | Tabs with nice scroll (no scrollbar) and responsive |
| [Segment for Blazor](https://www.puresourcecode.com/dotnet/blazor/segment-control-for-blazor/) | [Forum](https://www.puresourcecode.com/forum/forum/segments-for-blazor/) |  | | This is a Segment component for Blazor Web Assembly and Blazor Server |
| [Tabs for Blazor](https://www.puresourcecode.com/dotnet/blazor/tabs-control-for-blazor/) | [Forum](https://www.puresourcecode.com/forum/forum/tabs-for-blazor/) |  | | This is a Tabs component for Blazor Web Assembly and Blazor Server |
| [Timeline for Blazor](https://www.puresourcecode.com/dotnet/blazor/timeline-component-for-blazor/) | [Forum](https://www.puresourcecode.com/forum/timeline/) |  | | This is a new responsive timeline for Blazor Web Assembly and Blazor Server |
| [Toast for Blazor](https://www.puresourcecode.com/forum/psc-components-and-source-code/) | [Forum](https://www.puresourcecode.com/forum/psc-components-and-source-code/) |  | | Toast notification for Blazor applications |
| [Tours for Blazor](https://www.puresourcecode.com/forum/psc-components-and-source-code/) | [Forum](https://www.puresourcecode.com/forum/psc-components-and-source-code/) |  | | Guide your users in your Blazor applications |
| [TreeView for Blazor]() | [Forum](https://puresourcecode.com/forum/treeview/) |  | | This component is a native Blazor TreeView component for [Blazor WebAssembly](https://www.puresourcecode.com/tag/blazor-webassembly/) and [Blazor Server](https://www.puresourcecode.com/tag/blazor-server/). The component is built with .NET7. |
| [WorldMap for Blazor](https://puresourcecode.com/dotnet/blazor/world-map-component-for-blazor) | [Forum](https://www.puresourcecode.com/forum/worldmap-for-blazor/) |  | [Demo](https://worldmap.puresourcecode.com/) | Show world maps with your data |
## C# libraries for .NET6
| Component name | Forum | NuGet | Description |
|---|---|---|---|
| [PSC.Evaluator](https://www.puresourcecode.com/forum/psc-components-and-source-code/) | [Forum](https://www.puresourcecode.com/forum/forum/psc-extensions/) |  | PSC.Evaluator is a mathematical expressions evaluator library written in C#. Allows to evaluate mathematical, boolean, string and datetime expressions. |
| [PSC.Extensions](https://www.puresourcecode.com/dotnet/net-core/a-lot-of-functions-for-net5/) | [Forum](https://www.puresourcecode.com/forum/forum/psc-extensions/) |  | A lot of functions for .NET5 in a NuGet package that you can download for free. We collected in this package functions for everyday work to help you with claim, strings, enums, date and time, expressions... |
## C# libraries for .NET8
| Component name | Forum | NuGet | Description |
|---|---|---|---|
| [PSC.CSharp.Library.CountryData](https://puresourcecode.com/dotnet/net8/country-data-library-for-net8/) | |  | A simple cross platform offline .NET library for getting country data. |
| PSC.CSharp.Library.LanguageData | |  | This library is a comprehensive language code information, consisting of ISO 639-1, ISO 639-2 and IETF language types for C#. |
## More examples and documentation
### Blazor
* [Write a reusable Blazor component](https://www.puresourcecode.com/dotnet/blazor/write-a-reusable-blazor-component/)
* [Getting Started With C# And Blazor](https://www.puresourcecode.com/dotnet/net-core/getting-started-with-c-and-blazor/)
* [Setting Up A Blazor WebAssembly Application](https://www.puresourcecode.com/dotnet/blazor/setting-up-a-blazor-webassembly-application/)
* [Working With Blazor Component Model](https://www.puresourcecode.com/dotnet/blazor/working-with-blazors-component-model/)
* [Secure Blazor WebAssembly With IdentityServer4](https://www.puresourcecode.com/dotnet/blazor/secure-blazor-webassembly-with-identityserver4/)
* [Blazor Using HttpClient With Authentication](https://www.puresourcecode.com/dotnet/blazor/blazor-using-httpclient-with-authentication/)
* [InputSelect component for enumerations in Blazor](https://www.puresourcecode.com/dotnet/blazor/inputselect-component-for-enumerations-in-blazor/)
* [Use LocalStorage with Blazor WebAssembly](https://www.puresourcecode.com/dotnet/blazor/use-localstorage-with-blazor-webassembly/)
* [Modal Dialog component for Blazor](https://www.puresourcecode.com/dotnet/blazor/modal-dialog-component-for-blazor/)
* [Create Tooltip component for Blazor](https://www.puresourcecode.com/dotnet/blazor/create-tooltip-component-for-blazor/)
* [Consume ASP.NET Core Razor components from Razor class libraries | Microsoft Docs](https://docs.microsoft.com/en-us/aspnet/core/blazor/components/class-libraries?view=aspnetcore-5.0&tabs=visual-studio)
* [ChartJs component for Blazor](https://www.puresourcecode.com/dotnet/blazor/blazor-component-for-chartjs/)
* [Labels and OnClickChart for ChartJs](https://www.puresourcecode.com/dotnet/blazor/labels-and-onclickchart-for-chartjs/)
### Blazor & NET8
* [Custom User Management with NET8 and Blazor (1st part)](https://puresourcecode.com/dotnet/blazor/custom-user-management-with-net8-and-blazor/)
* [NET8, Blazor and Custom User Management (2nd part)](https://puresourcecode.com/dotnet/blazor/net8-blazor-and-custom-user-management/)