This is more a question I’m asking to understand rather than figure out a problem. Consider the following two:
[Flags]
public enum Flags
{
NONE = 0x0,
PASSUPDATE = 0x1,
PASSRENDER = 0x2,
DELETE = 0x4,
ACCEPTINPUT = 0x8,
FADE_IN = 0x10,
FADE_OUT = 0x20,
FADE_OUT_COMPLETE = 0x40
}
[Flags]
public enum Flags
{
NONE = 0x0,
PASSUPDATE,
PASSRENDER,
DELETE,
ACCEPTINPUT,
FADE_IN ,
FADE_OUT,
FADE_OUT_COMPLETE
}
If I do bit checking on something using the latter enum there sometimes is overlap (I think something like DELETE is interpreted as PASSUPDATE | PASSRENDER, while in the first example each entry is independent of the other (i.e. DELETE is only DELETE and cannot be proven using a combination of a different set of flags).
Without explicit numbers, enums increment by 1 each time (even with
[Flags]specified), so you get:which is simply not the numbers you wanted (and certainly isn’t bitwise flags which are typically successive powers of 2)