Meziantou.Framework.FastEnumToStringGenerator
2.0.6
Prefix Reserved
dotnet add package Meziantou.Framework.FastEnumToStringGenerator --version 2.0.6
NuGet\Install-Package Meziantou.Framework.FastEnumToStringGenerator -Version 2.0.6
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="Meziantou.Framework.FastEnumToStringGenerator" Version="2.0.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Meziantou.Framework.FastEnumToStringGenerator" Version="2.0.6" />
<PackageReference Include="Meziantou.Framework.FastEnumToStringGenerator" />
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 Meziantou.Framework.FastEnumToStringGenerator --version 2.0.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Meziantou.Framework.FastEnumToStringGenerator, 2.0.6"
#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 Meziantou.Framework.FastEnumToStringGenerator@2.0.6
#: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=Meziantou.Framework.FastEnumToStringGenerator&version=2.0.6
#tool nuget:?package=Meziantou.Framework.FastEnumToStringGenerator&version=2.0.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Meziantou.Framework.FastEnumToStringGenerator
The source generator generates a ToStringFast method for some enumerations
[assembly: FastEnumToStringAttribute(typeof(Sample.Color), IsPublic = true, ExtensionMethodNamespace = "Sample.Extensions")]
namespace Sample
{
public enum Color
{
Blue,
Red,
Green,
}
}
The source generator adds the following code:
internal static partial class FastEnumToStringExtensions
{
internal static string ToStringFast(this Sample.Color value)
{
return value switch
{
case Blue => "Blue",
case Red => "Red",
case Green => "Green",
_ => value.ToString(),
};
}
}
You can now replace the ToString method with the new ToStringFast method:
Color value = Color.Green;
Console.WriteLine(value.ToStringFast());
Additional resources
There are no supported framework assets in this package.
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- No dependencies.
-
net10.0
- 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 |
|---|---|---|
| 2.0.6 | 187 | 4/25/2026 |
| 2.0.5 | 28,938 | 10/19/2025 |
| 2.0.4 | 537 | 9/21/2025 |
| 2.0.3 | 291 | 9/3/2025 |
| 2.0.2 | 44,514 | 11/17/2024 |
| 2.0.1 | 71,135 | 11/29/2023 |
| 2.0.0 | 5,909 | 11/19/2023 |
| 1.0.8 | 654 | 11/15/2023 |
| 1.0.7 | 5,010 | 9/6/2023 |
| 1.0.6 | 10,445 | 12/24/2022 |
| 1.0.5 | 3,767 | 11/10/2021 |
| 1.0.4 | 1,183 | 7/14/2021 |
| 1.0.3 | 773 | 6/30/2021 |
| 1.0.2 | 1,015 | 6/21/2021 |
| 1.0.1 | 796 | 6/16/2021 |
| 1.0.0 | 768 | 6/16/2021 |