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
> nuget.exe install Jcd.RichEnumerations -Version 0.2.24 -Source https://www.myget.org/F/jason-c-daniels/api/v3/index.json
> dotnet add package Jcd.RichEnumerations --version 0.2.24 --source https://www.myget.org/F/jason-c-daniels/api/v3/index.json
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
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
- .NETStandard 2.0: 2.0.0.0
OwnersJason C. Daniels |
AuthorsJason C. Daniels |
Project URLhttps://github.com/jason-c-daniels/Jcd.RichEnumerations |
LicenseUnknown |
Tagsrich-enum rich-enumeration rich-enums rich-enumerations ddd ddd-enumeration |
Info10 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 |