Cenum 1.0.4

dotnet add package Cenum --version 1.0.4
NuGet\Install-Package Cenum -Version 1.0.4
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="Cenum" Version="1.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Cenum --version 1.0.4
#r "nuget: Cenum, 1.0.4"
#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 Cenum as a Cake Addin
#addin nuget:?package=Cenum&version=1.0.4

// Install Cenum as a Cake Tool
#tool nuget:?package=Cenum&version=1.0.4

Cenum

Object-oriented alternative to C# enum - base for defining enumerations as classes with fields, properties and methods.

Usage

Define an enumeration by creating a partial class and decorating it with the Enumeration attribute. The class should have a public static readonly field for each value of the "enumeration".

Generated method Enumerate returns an IEnumerable<T> containing all values of the enumeration.

[Enumeration]
public partial class Number
{
    public static readonly Number One = new(1);
    public static readonly Number Two = new(2);
    public static readonly Number Three = new(3);
    
    private readonly int _value;
    
    private Number(int value) => _value = value;
    
    public override string ToString() => _value.ToString();
}


foreach (var number in Number.Enumerate())
{
    Console.WriteLine(number.ToString());
}

// Output:
// 1
// 2
// 3
There are no supported framework assets in this 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
1.0.4 0 5/3/2024
1.0.3 256 11/8/2023
1.0.2 163 11/2/2023
1.0.0 156 11/2/2023