suppose we have enumone that has FlagsAttribute.
[Flags]
enum CarOptions
{
Sunroof = 1,
Spoiler = 2,
TintedWindow = 4
}
It can be used easily. now suppose this
[Flags]
enum CarOptions
{
SunroofElectrical,
SunroofMechanical,
Spoiler,
TintedWindowBlack,
TintedWindowPurple
}
of course, this is syntactically incorrect. but a car cannot have a mechanical and electric sunroof at the same time or have black and purple tinted wallpapers. The question is: is there a mechanism for implementing the Flags enumeration that cannot have some attributes at the same time?
user415789
source
share