Soenneker.SmartEnum.Abbreviated 2.1.76

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
dotnet add package Soenneker.SmartEnum.Abbreviated --version 2.1.76
NuGet\Install-Package Soenneker.SmartEnum.Abbreviated -Version 2.1.76
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Soenneker.SmartEnum.Abbreviated" Version="2.1.76" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Soenneker.SmartEnum.Abbreviated --version 2.1.76
#r "nuget: Soenneker.SmartEnum.Abbreviated, 2.1.76"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Soenneker.SmartEnum.Abbreviated as a Cake Addin
#addin nuget:?package=Soenneker.SmartEnum.Abbreviated&version=2.1.76

// Install Soenneker.SmartEnum.Abbreviated as a Cake Tool
#tool nuget:?package=Soenneker.SmartEnum.Abbreviated&version=2.1.76

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 Soenneker.SmartEnum.Abbreviated

A derivative of Ardalis' SmartEnum, adding support for abbrevations

Installation

dotnet add package Soenneker.SmartEnum.Abbreviated

Usage

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 Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
2.1.76 80 4/30/2024
2.1.75 58 4/30/2024
2.1.74 73 4/30/2024
2.1.73 63 4/30/2024
2.1.72 82 4/30/2024
2.1.71 61 4/29/2024
2.1.70 60 4/29/2024
2.1.69 90 4/29/2024
2.1.68 71 4/29/2024
2.1.67 68 4/29/2024
2.1.66 72 4/29/2024
2.1.65 71 4/28/2024
2.1.64 63 4/28/2024
2.1.63 80 4/28/2024
2.1.62 63 4/28/2024
2.1.61 78 4/28/2024
2.1.60 77 4/28/2024
2.1.59 88 4/28/2024
2.1.58 60 4/28/2024
2.1.57 76 4/28/2024
2.1.56 64 4/28/2024
2.1.55 79 4/28/2024
2.1.54 64 4/28/2024
2.1.53 79 4/28/2024
2.1.52 68 4/28/2024
2.1.51 74 4/27/2024
2.1.50 172 4/20/2024
2.1.49 86 4/20/2024
2.1.48 91 4/19/2024
2.1.47 69 4/19/2024
2.1.46 73 4/19/2024
2.1.45 66 4/19/2024
2.1.44 85 4/19/2024
2.1.43 87 4/19/2024
2.1.42 74 4/19/2024
2.1.41 82 4/18/2024
2.1.40 134 4/13/2024
2.1.39 86 4/13/2024
2.1.38 78 4/13/2024
2.1.37 82 4/13/2024
2.1.36 52 4/13/2024
2.1.35 86 4/12/2024
2.1.34 78 4/12/2024
2.1.33 64 4/12/2024
2.1.32 88 4/12/2024
2.1.31 71 4/12/2024
2.1.30 84 4/12/2024
2.1.29 64 4/12/2024
2.1.28 101 4/12/2024
2.1.27 59 4/12/2024
2.1.26 82 4/12/2024
2.1.25 74 4/12/2024
2.1.24 78 4/12/2024
2.1.23 85 4/11/2024
2.1.22 74 4/11/2024
2.1.21 100 4/10/2024
2.1.20 80 4/10/2024
2.1.19 69 4/10/2024
2.1.18 83 4/10/2024
2.1.17 73 4/10/2024
2.1.16 78 4/10/2024
2.1.15 57 4/10/2024
2.1.14 226 4/3/2024
2.1.13 73 4/2/2024
2.1.12 66 4/2/2024
2.1.11 62 4/2/2024
2.1.10 65 4/2/2024
2.1.9 50 4/2/2024
2.1.8 66 4/1/2024
2.1.7 62 4/1/2024
2.1.6 60 4/1/2024
2.1.5 74 3/31/2024
2.1.4 76 3/30/2024
2.1.3 69 3/30/2024
2.1.2 77 3/27/2024