Soenneker.Enums.CountryType
4.0.1002
Prefix Reserved
dotnet add package Soenneker.Enums.CountryType --version 4.0.1002
NuGet\Install-Package Soenneker.Enums.CountryType -Version 4.0.1002
<PackageReference Include="Soenneker.Enums.CountryType" Version="4.0.1002" />
<PackageVersion Include="Soenneker.Enums.CountryType" Version="4.0.1002" />
<PackageReference Include="Soenneker.Enums.CountryType" />
paket add Soenneker.Enums.CountryType --version 4.0.1002
#r "nuget: Soenneker.Enums.CountryType, 4.0.1002"
#:package Soenneker.Enums.CountryType@4.0.1002
#addin nuget:?package=Soenneker.Enums.CountryType&version=4.0.1002
#tool nuget:?package=Soenneker.Enums.CountryType&version=4.0.1002
Soenneker.Enums.CountryType
A smart enum of countries and territories with stable numeric values, ISO 3166-1 alpha-2 abbreviations, and CLDR-style display names.
Installation
dotnet add package Soenneker.Enums.CountryType
Usage
using Soenneker.Enums.CountryType;
CountryType country = CountryType.UnitedStates;
string name = country.Name; // "UnitedStates"
int value = country.Value; // 235
string code = country.Abbreviation; // "US"
string displayName = country.Description; // "United States"
Look up a country by its two-letter code:
CountryType canada = CountryType.FromAbbreviation("CA");
if (CountryType.TryFromAbbreviation(input, ignoreCase: true, out CountryType? country))
{
Console.WriteLine(country.Description);
}
FromAbbreviation throws when the code is unknown. Use TryFromAbbreviation for user or external input.
The inherited smart-enum APIs are also available for names and numeric values:
CountryType germany = CountryType.FromName("Germany");
CountryType france = CountryType.FromValue(76);
foreach (CountryType option in CountryType.List)
{
Console.WriteLine($"{option.Abbreviation}: {option.Description}");
}
Name is the C# identifier used by the enum entry, while Description is intended for display. They differ for entries such as UnitedStates / United States; use Abbreviation when exchanging ISO country codes.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Soenneker.SmartEnum.AbbreviatedDescriptive (>= 4.0.1024)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.1002 | 0 | 10/14/2026 |
| 4.0.1000 | 0 | 10/14/2026 |
| 4.0.995 | 34 | 10/13/2026 |
| 4.0.994 | 47 | 10/12/2026 |
| 4.0.993 | 49 | 10/12/2026 |
| 4.0.992 | 55 | 10/12/2026 |
| 4.0.991 | 49 | 10/12/2026 |
| 4.0.990 | 53 | 10/12/2026 |
| 4.0.989 | 52 | 10/11/2026 |
| 4.0.988 | 58 | 10/11/2026 |
| 4.0.987 | 59 | 10/11/2026 |
| 4.0.986 | 111 | 10/6/2026 |
| 4.0.985 | 82 | 10/6/2026 |
| 4.0.984 | 116 | 9/30/2026 |
| 4.0.983 | 115 | 9/26/2026 |
| 4.0.982 | 96 | 9/25/2026 |
| 4.0.981 | 97 | 9/24/2026 |
| 4.0.980 | 110 | 9/16/2026 |
| 4.0.979 | 98 | 9/16/2026 |
| 4.0.978 | 100 | 9/15/2026 |
Update dependency dotnet-sdk to v10.0.402 (#1595)