LinkDotNet.Enumeration 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package LinkDotNet.Enumeration --version 1.0.0
                    
NuGet\Install-Package LinkDotNet.Enumeration -Version 1.0.0
                    
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="LinkDotNet.Enumeration" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LinkDotNet.Enumeration" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="LinkDotNet.Enumeration" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add LinkDotNet.Enumeration --version 1.0.0
                    
#r "nuget: LinkDotNet.Enumeration, 1.0.0"
                    
#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.
#:package LinkDotNet.Enumeration@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=LinkDotNet.Enumeration&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=LinkDotNet.Enumeration&version=1.0.0
                    
Install as a Cake Tool

Enumeration

.NET Nuget GitHub tag

Source code generated string Enumeration with completeness!

What is in the box?

This source code generator let's you easily create string based enumerations with a lot of features.

[Enumeration("Red", "Green", "Blue")]
public sealed partial class Color;

That's all you need to do to create a string based enumeration. You can either use it like this:

var color = Color.Red;

// Create it by a string key:
var color = Color.Create("Red");

Exhaustiveness

The great benefit of the library is that you have support for exhaustiveness:


var color = Color.Create("Red");

color.Match(
    red => Console.WriteLine("It's red!"),
    green => Console.WriteLine("It's green!"),
    blue => Console.WriteLine("It's blue!")
);

Or return a value:

var color = Color.Create("Red");

var colorCode = color.Match(
    red => "#FF0000",
    green => "#00FF00",
    blue => "#0000FF"
);

Limitations

  • Your code should run at least net8.0 or later, as the library uses things like FrozenSet.
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

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.3.1 82 4/6/2026
1.3.0 81 4/6/2026
1.2.0 81 4/6/2026
1.1.0 77 4/6/2026
1.0.1 80 4/5/2026
1.0.0 79 4/5/2026