Source generator that generates useful extension and utility methods for enums
- Annotate your enum with
[GenerateExtensions]AttributeYou can optionally provide a
ClassNamefor the generated class like so:[GenerateExtensions(ClassName = "NameOfGeneratedClass")]. By default, the name of the enum followed by the "Extensions" suffix is used as the class name. Similarly, You can also provide an optionalNamespacefor the generated class. Default namespace is the same as the enum. - Done!
using EnumExtensions;
[GenerateExtensions]
enum Direction
{
Up,
Down,
Left,
Right
}TODO
TODO
Is*()GetValues()GetNames()GetValuesEnumerable()GetNamesEnumerable()ToStringFast()Next()Previous()GetRandomValue()GetRandomValueExcluding()TryParse()Parse()ParseOrDefault()ParseOrThrow()ParseOrElse()TryParseIgnoreCase()ParseIgnoreCase()ParseOrDefaultIgnoreCase()ParseOrThrowIgnoreCase()ParseOrElseIgnoreCase()