-
-
Notifications
You must be signed in to change notification settings - Fork 186
Open
Description
This could be improved further with source generators:
Allowing you to just decorate a partial class like so:
using Ardalis.SmartEnum;
[SmartEnum]
public sealed partial class TestEnum
{
[EnumMember]
public static readonly TestEnum One;
[EnumMember]
public static readonly TestEnum Two;
[EnumMember]
public static readonly TestEnum Three;
}Generated code:
using Ardalis.SmartEnum;
sealed partial class TestEnum : SmartEnum<TestEnum>
{
private TestEnum(string name, int value) : base(name, value)
{
One = new TestEnum(nameof(One), 1);
Two = new TestEnum(nameof(Two), 2);
Three = new TestEnum(nameof(Three), 3);
}
}LucaGanio, aresofficial, dgmagno, prlcutting and glen-84