![]() |
VOOZH | about |
dotnet add package Soenneker.SmartEnum.Abbreviated --version 4.0.1344
NuGet\Install-Package Soenneker.SmartEnum.Abbreviated -Version 4.0.1344
<PackageReference Include="Soenneker.SmartEnum.Abbreviated" Version="4.0.1344" />
<PackageVersion Include="Soenneker.SmartEnum.Abbreviated" Version="4.0.1344" />Directory.Packages.props
<PackageReference Include="Soenneker.SmartEnum.Abbreviated" />Project file
paket add Soenneker.SmartEnum.Abbreviated --version 4.0.1344
#r "nuget: Soenneker.SmartEnum.Abbreviated, 4.0.1344"
#:package Soenneker.SmartEnum.Abbreviated@4.0.1344
#addin nuget:?package=Soenneker.SmartEnum.Abbreviated&version=4.0.1344Install as a Cake Addin
#tool nuget:?package=Soenneker.SmartEnum.Abbreviated&version=4.0.1344Install as a Cake Tool
👁 alternate text is missing from this package README image
👁 alternate text is missing from this package README image
👁 alternate text is missing from this package README image
👁 alternate text is missing from this package README image
dotnet add package Soenneker.SmartEnum.Abbreviated
The AbbreviatedSmartEnum class is an abstract base class that extends the SmartEnum class from Ardalis' library. It provides additional functionality for working with abbreviated enum values.
To create an abbreviated SmartEnum, you need to derive a new class from AbbreviatedSmartEnum<TEnum>.
public class LanguageType : AbbreviatedSmartEnum<LanguageType>
{
public static readonly LanguageType English = new(nameof(English), 1, "EN");
public static readonly LanguageType Spanish = new(nameof(Spanish), 2, "ES");
public static readonly LanguageType French = new(nameof(French), 3, "FR");
private LanguageType(string name, int value, string abbreviation)
: base(name, value, abbreviation)
{
}
}
and how you use your new SmartEnum:
string abbreviated = LanguageType.English.Abbreviation; // "EN"
// Get the enum value for the "EN" abbreviation
LanguageType english = LanguageType.FromAbbreviation("EN");
// Try to get the enum value for the "ES" abbreviation (case-insensitive)
if (LanguageType.TryFromAbbreviation("es", ignoreCase: true, out LanguageType spanish))
{
// spanish will be the LanguageType.Spanish value
}
The IgnoreCase and StaticIgnoreCase properties allow you to control whether the abbreviation matching is case-sensitive or case-insensitive, either for a specific instance or globally across all instances of the derived enum class.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 2 NuGet packages that depend on Soenneker.SmartEnum.Abbreviated:
| Package | Downloads |
|---|---|
|
Soenneker.SmartEnum.AbbreviatedDescriptive
A derivative of AbbreviatedSmartEnum adding support for descriptions |
|
|
Soenneker.Json.Converters.AbbreviatedSmartEnum
A System.Text.Json AbbreviatedSmartEnum converter |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.1344 | 0 | 6/18/2026 |
| 4.0.1342 | 88 | 6/16/2026 |
| 4.0.1341 | 87 | 6/16/2026 |
| 4.0.1340 | 250 | 6/10/2026 |
| 4.0.1339 | 168 | 6/9/2026 |
| 4.0.1338 | 187 | 6/9/2026 |
| 4.0.1337 | 206 | 6/6/2026 |
| 4.0.1336 | 168 | 6/6/2026 |
| 4.0.1335 | 119 | 6/6/2026 |
| 4.0.1334 | 147 | 6/6/2026 |
| 4.0.1333 | 113 | 6/5/2026 |
| 4.0.1331 | 166 | 6/5/2026 |
| 4.0.1329 | 487 | 5/13/2026 |
| 4.0.1328 | 547 | 5/2/2026 |
| 4.0.1327 | 348 | 4/23/2026 |
| 4.0.1326 | 163 | 4/23/2026 |
| 4.0.1324 | 162 | 4/23/2026 |
| 4.0.1323 | 108 | 4/23/2026 |
| 4.0.1322 | 161 | 4/22/2026 |
| 4.0.1321 | 152 | 4/22/2026 |
Update dependency Soenneker.Extensions.Type to 4.0.687 (#1779)