Enum types, FlagsAttribute & Zero value – Part 2
In my previous post I wrote about why you should pay attention when using enum value Zero.
After reading that post you are probably thinking like Benjamin Roux: Why don’t you start the enum
values at 0x1
?
Well I could, but doing that I lose the ability to have Sync and Async mutually exclusive by design. Take a look at the following enum types:
[Flags] public enum OperationMode1 { Async = 0x1, Sync = 0x2, Parent = 0x4 } [Flags] public enum OperationMode2 { Async = 0x0, Sync = 0x1, Parent = 0x2 }