WoW2.Backbone.Language.Core.Extensions.Enums 9.0.0-alpha.1

Prefix Reserved
This is a prerelease version of WoW2.Backbone.Language.Core.Extensions.Enums.
dotnet add package WoW2.Backbone.Language.Core.Extensions.Enums --version 9.0.0-alpha.1
                    
NuGet\Install-Package WoW2.Backbone.Language.Core.Extensions.Enums -Version 9.0.0-alpha.1
                    
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="WoW2.Backbone.Language.Core.Extensions.Enums" Version="9.0.0-alpha.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="WoW2.Backbone.Language.Core.Extensions.Enums" Version="9.0.0-alpha.1" />
                    
Directory.Packages.props
<PackageReference Include="WoW2.Backbone.Language.Core.Extensions.Enums" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add WoW2.Backbone.Language.Core.Extensions.Enums --version 9.0.0-alpha.1
                    
#r "nuget: WoW2.Backbone.Language.Core.Extensions.Enums, 9.0.0-alpha.1"
                    
#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.
#:package WoW2.Backbone.Language.Core.Extensions.Enums@9.0.0-alpha.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=WoW2.Backbone.Language.Core.Extensions.Enums&version=9.0.0-alpha.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=WoW2.Backbone.Language.Core.Extensions.Enums&version=9.0.0-alpha.1&prerelease
                    
Install as a Cake Tool

WoW2.Backbone.Language.Core.Extensions.Enums

Provides extension methods for enum types.

Installation

dotnet add package WoW2.Backbone.Language.Core.Extensions.Enums

Features

  • Retrieving custom attribute value or collection of custom attributes
  • Retrieving enum description or attempting to retrieve
  • Parsing enum by description or attempting to parse

Performance

Method Mean Error StdDev Gen0 Allocated
Benchmark_GetDescription_Existing 347.53 ns 6.261 ns 5.228 ns 0.0324 272 B
Benchmark_GetDescriptionOrValue_Existing 344.25 ns 3.247 ns 2.879 ns 0.0324 272 B
Benchmark_GetDescriptionOrValue_Missing 56.03 ns 0.795 ns 0.705 ns 0.0029 24 B
Benchmark_TryGetDescription_Existing 348.34 ns 5.894 ns 5.225 ns 0.0324 272 B
Benchmark_TryGetDescription_Missing 59.25 ns 1.176 ns 1.155 ns 0.0029 24 B
Benchmark_ParseByDescription_Valid 1,575.74 ns 13.252 ns 11.066 ns 0.1717 1440 B
Benchmark_TryParseByDescription_Generic_Valid 1,560.11 ns 8.809 ns 8.240 ns 0.1736 1464 B
Benchmark_TryParseByDescription_Generic_Invalid 1,789.04 ns 24.598 ns 20.541 ns 0.1717 1440 B
Benchmark_TryParseByDescription_NonGeneric_Valid 1,970.65 ns 18.489 ns 15.439 ns 0.1755 1488 B
Benchmark_TryParseByDescription_NonGeneric_Invalid 1,709.78 ns 10.634 ns 9.426 ns 0.1793 1512 B
Benchmark_GetAllValuesAndDescriptions_Generic NA NA NA NA NA
Benchmark_GetAllValuesAndDescriptions_NonGeneric NA NA NA NA NA
Benchmark_GetAllAvailableValuesAndDescriptions_Generic 1,539.13 ns 15.890 ns 14.086 ns 0.1602 1352 B
Benchmark_GetAllAvailableValuesAndDescriptions_NonGeneric 1,696.32 ns 7.668 ns 5.986 ns 0.1659 1400 B
Benchmark_GetCustomAttributeValue_Existing 337.99 ns 0.997 ns 0.933 ns 0.0324 272 B
Benchmark_GetCustomAttributeValue_Missing 53.17 ns 0.172 ns 0.143 ns 0.0029 24 B
Benchmark_GetAllValuesAndAttributeValues 848.70 ns 4.843 ns 4.044 ns 0.0916 768 B

Structure

  • EnumAttributeExtensions -
  • EnumDescriptionExtensions -

Usage

dotnet add package WoW2.Backbone.Language.Core.Extensions.Enums
using WoW2.Backbone.Language.Core.Extensions.Enums;

public enum Status
{
    [Description("Active Status")]
    Active,
    Inactive
}

// Get description
var description = Status.Active.GetDescription();

// Parse safely
var status = EnumDescriptionExtensions.ParseByDescription<Status>("Active");

// Validate
var isValid = EnumDescriptionExtensions.TryParseByDescription<Status>("Active", out var result);

## Requirements

- .NET 9.0 or higher

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

---

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

    • No dependencies.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on WoW2.Backbone.Language.Core.Extensions.Enums:

Package Downloads
WoW2.Backbone.Language.Features.Serialization.Json.Newtonsoft.Converters

Custom converters for JSON serialization using Newtonsoft.Json in language feature sets

WoW2.Backbone.Language.Core.Extensions.Enums.Ranges

Extension for correlated enums using numeric range.

WoW2.Backbone.Language.Core.Extensions.Enums.Correlation

Extension for correlated enums with additional correlation features.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
9.0.0-alpha.1 226 2/22/2025
9.0.0-alpha.0 183 2/13/2025
8.0.0-alpha.0 251 11/6/2024