Closed MatteoZampariniDev closed 2 weeks ago
Describe the feature
Is it possible to add a source generated method/property that returns a collection of all defined [Instance] values?
[ValueObject<string>] [Instance("Pdf", "pdf")] [Instance("Txt", "txt")] public readonly partial struct StoredFileType { public static Validation Validate(string value) => GetAllValues().Any(x => x.Value == value) ? Validation.Ok : Validation.Invalid("Invalid value"); public static StoredFileType[] GetAllValues() => [ StoredFileType.Pdf, StoredFileType.Txt // source generation? ]; }
Thank you
Hi, thanks for the feedback. Have a look at https://github.com/SteveDunn/Intellenum
Thank you
Thank you
Very welcome, let me know if this suits your needs. Any feedback on Intellenum greatly appreciated too!
Describe the feature
Is it possible to add a source generated method/property that returns a collection of all defined [Instance] values?
Thank you