Strinum 2.1.1

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

// Install Strinum as a Cake Tool
#tool nuget:?package=Strinum&version=2.1.1

Strinum

Versatile source code tool designed to automate the generation of stringification extension methods for enum types. By intelligently scanning your source code, this generator identifies enum types and creates streamlined methods for converting enum members to human-readable string representations. Improve code readability, simplify debugging, and boost productivity with EnumStringifyGenerator – the essential companion for enum handling in your projects.

Usage

The Stringify() extension method is generated for each enum type in your source code. If you call it on an enum member, it will return the member represented as a string.

public enum Number
{
    One,
    Two,
    Three
}

 Console.WriteLine(Number.One.Stringify());
 Console.WriteLine(Number.Two.Stringify());
 Console.WriteLine(Number.Three.Stringify());

// Output:
// One
// Two
// Three

Customizing outputs

Sometimes you want to change the output of a stringified enum value. To do that, you can use StringifyAttribute to override the default enum string value.

using Strinum;

public enum Number
{
    [Stringify("NumberOne")] One,
    [Stringify("number_two")] Two,
    [Stringify("number-three")] Three,
    [Stringify("numberFour")] Four,
    [Stringify("Number 5")] Five
}

Console.WriteLine(Number.One.Stringify());
Console.WriteLine(Number.Two.Stringify());
Console.WriteLine(Number.Three.Stringify());
Console.WriteLine(Number.Four.Stringify());
Console.WriteLine(Number.Five.Stringify());

// Output:
// NumberOne
// number_two
// number-three
// numberFour
// Number 5
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
2.1.1 205 12/7/2023
2.1.0 195 12/6/2023
2.0.0 212 11/12/2023
1.0.0 189 11/9/2023