jason-c-daniels - Jcd.RichEnumerations 0.2.24

A .netstandard 2.0 library that provides DDD-style rich enumeration base types for both plain old classes and record types.

PM> Install-Package Jcd.RichEnumerations -Version 0.2.24 -Source https://www.myget.org/F/jason-c-daniels/api/v3/index.json

Copy to clipboard

> nuget.exe install Jcd.RichEnumerations -Version 0.2.24 -Source https://www.myget.org/F/jason-c-daniels/api/v3/index.json

Copy to clipboard

> dotnet add package Jcd.RichEnumerations --version 0.2.24 --source https://www.myget.org/F/jason-c-daniels/api/v3/index.json

Copy to clipboard
<PackageReference Include="Jcd.RichEnumerations" Version="0.2.24" />
Copy to clipboard
source https://www.myget.org/F/jason-c-daniels/api/v3/index.json

nuget Jcd.RichEnumerations  ~> 0.2.24
Copy to clipboard

> choco install Jcd.RichEnumerations --version 0.2.24 --source https://www.myget.org/F/jason-c-daniels/api/v2

Copy to clipboard
Import-Module PowerShellGet
Register-PSRepository -Name "jason-c-daniels" -SourceLocation "https://www.myget.org/F/jason-c-daniels/api/v2"
Install-Module -Name "Jcd.RichEnumerations" -RequiredVersion "0.2.24" -Repository "jason-c-daniels" 
Copy to clipboard

Jcd.RichEnumerations

A netstandard2.0 library that provides DDD-style rich enumeration base types for both plain old classes and record types.

Examples

// define the rich enum type.

using Jcd.RichEnumerations.Wrappers

// Derive from a simplifying wrapper. In this case one that already defines the description property.
public class MyRichEnum(int value, string description) : DescribedRichEnum<MyRichEnum>(value,description)
{
   public static readonly MyRichEnum Item1 = new(1, "Item 1");
   public static readonly MyRichEnum Item2 = new(2, "Item 2");
   public static readonly MyRichEnum Item3 = new(3, "Item 3");
}

// use the values
int userInput = GetUserInput();

// use the conversion operator to convert the raw number into an instance of the RichEnum.
var  ev = (MyRichEnum) userInput;

if (ev == MyRichEnum.Item1) {
   //.. do something specific to Item1 being selected.
}

Badges

GitHub Build status CodeFactor Grade

MyGet Nuget

API Docs User Guide

  • .NETStandard 2.0
    • Jcd.BitManipulation (>= 3.0.121)
  • .NETStandard 2.0: 2.0.0.0

Owners

Jason C. Daniels

Authors

Jason C. Daniels

Project URL

https://github.com/jason-c-daniels/Jcd.RichEnumerations

License

Unknown

Tags

rich-enum rich-enumeration rich-enums rich-enumerations ddd ddd-enumeration

Info

10 total downloads
2 downloads for version 0.2.24
Download (48.63 KB)
Found on the current feed only

Package history

Version Size Last updated Downloads Mirrored?
0.2.24 48.63 KB Sun, 14 Apr 2024 19:15:08 GMT 2
0.2.21-alpha 48.65 KB Sun, 14 Apr 2024 13:42:16 GMT 0
0.2.16-alpha 48.64 KB Sun, 14 Apr 2024 07:32:58 GMT 2
0.1.13 44.1 KB Sat, 13 Apr 2024 20:52:04 GMT 2
0.1.8 44 KB Fri, 12 Apr 2024 17:28:02 GMT 0
0.1.2 43.81 KB Wed, 10 Apr 2024 20:10:41 GMT 0
0.1.1 43.8 KB Wed, 10 Apr 2024 09:24:53 GMT 0
0.1.0 34.33 KB Tue, 09 Apr 2024 01:08:53 GMT 4
0.0.11 11.86 KB Thu, 22 Feb 2024 17:57:22 GMT 0