assume we have an enum that has FlagsAttribute.
[Flags]
enum CarOptions
{
Sunroof = 1,
Spoiler = 2,
TintedWindow = 4
}
this could be used easily. now assume this one
[Flags]
enum CarOptions
{
SunroofElectrical,
SunroofMechanical,
Spoiler,
TintedWindowBlack,
TintedWindowPurple
}
of course this is syntactically incorrect. but a Car can't have Mechanical and Electrical Sunroof at the same time or having Black and Purple TintedWindow both.
The question is: Is there a mechanism to implement the Flags enumeration which cannot have some attributes simultaneously?
I guess you would do this by using different enums for Sunroofs and TindedWindows.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With