Cenum 1.0.3

dotnet add package Cenum --version 1.0.3
NuGet\Install-Package Cenum -Version 1.0.3
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.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Cenum --version 1.0.3
#r "nuget: Cenum, 1.0.3"
#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.3

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

Usage

The source generator will scan the source code for classes marked with the [Enumeration] attribute and then generate an Enumerate() method for them. The method will enumerate all public static readonly fields with the same type as the marked class itself.

An enumeration class cannot be nested or contain the static modifier.

Example

[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.3 256 11/8/2023
1.0.2 163 11/2/2023
1.0.0 156 11/2/2023