ardalis/SmartEnum

Doesn't seem to have support for Flags Enums

Offen

#59 geöffnet am 27.11.2019

 (8 Kommentare) (3 Reaktionen) (0 zugewiesene Personen)C# (185 Forks)github user discovery
enhancementgood first issuehelp wanted

Repository-Metriken

Stars
 (2.420 Sterne)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

My team really likes this project and would like to use it for our codebase! Unfortunately, we have several flags enums and they don't seem to be compatible with this project. :(

The FromValue method throws a SmartEnumNotFoundException when given a flags enum value as well as casting a flags value.

// Given SomeEnum.A is 1 and SomeEnum.B is 2, all three throw the exception
SomeEnum.FromValue(SomeEnum.A | SomeEnum.B);
SomeEnum.FromValue(3); 
(SomeEnum)3

Also, there's no way to get the Name of multiple values with the logical OR operator like we get when the Flags attribute is placed on an enum (i.e. SomeEnum.B | SomeEnum.C => B, C).

Will this project include this support in the near future?

Contributor Guide