jason-c-daniels - Jcd.RichEnumerations 0.2.16-alpha

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.16-alpha -Source https://www.myget.org/F/jason-c-daniels/api/v3/index.json

Copy to clipboard

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

Copy to clipboard

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

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

nuget Jcd.RichEnumerations  ~> 0.2.16-alpha
Copy to clipboard

> choco install Jcd.RichEnumerations --version 0.2.16-alpha --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.16-alpha" -Repository "jason-c-daniels" -AllowPreRelease
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.108-alpha)
  • .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

1142 total downloads
75 downloads for version 0.2.16-alpha
Download (48.64 KB)
Found on the current feed only

Package history

Version Size Last updated Downloads Mirrored?
0.2.51 51.36 KB Sat, 24 Aug 2024 20:33:31 GMT 72
0.2.48 51.48 KB Mon, 05 Aug 2024 11:25:45 GMT 77
0.2.39 51.5 KB Thu, 01 Aug 2024 02:30:10 GMT 74
0.2.33 51.11 KB Sat, 27 Jul 2024 23:12:21 GMT 68
0.2.30 48.42 KB Sat, 27 Jul 2024 19:37:43 GMT 75
0.2.29 48.37 KB Sat, 27 Jul 2024 19:19:37 GMT 84
0.2.24 48.63 KB Sun, 14 Apr 2024 19:15:08 GMT 79
0.2.21-alpha 48.65 KB Sun, 14 Apr 2024 13:42:16 GMT 79
0.2.16-alpha 48.64 KB Sun, 14 Apr 2024 07:32:58 GMT 75
0.1.13 44.1 KB Sat, 13 Apr 2024 20:52:04 GMT 73
0.1.8 44 KB Fri, 12 Apr 2024 17:28:02 GMT 67
0.1.2 43.81 KB Wed, 10 Apr 2024 20:10:41 GMT 80
0.1.1 43.8 KB Wed, 10 Apr 2024 09:24:53 GMT 89
0.1.0 34.33 KB Tue, 09 Apr 2024 01:08:53 GMT 84
0.0.11 11.86 KB Thu, 22 Feb 2024 17:57:22 GMT 66