amis92 / csharp-source-generators

A list of C# Source Generators (not necessarily awesome) and associated resources: articles, talks, demos.
Creative Commons Zero v1.0 Universal
2.03k stars 202 forks source link

Add BetterEnums #103

Closed Ceiridge closed 2 years ago

Ceiridge commented 2 years ago

A source generator that adds extension methods for enums with any attribute. Also adds more performant methods (BetterToString). Adds methods such as:

// Faster ToString
ExampleEnum.AnExample.BetterToString();
// Access the value attributes directly
ExampleEnum.Another.GetExampleEnumInfo();
ExampleEnum.Another.GetDescription().Description;