This question already has answers here: Closed 11 years ago. Possible Duplicate: C# int to enum conversion
Assume that there are flag definitions such as: SHF_WRITE0x1 SHF_ALLOC0x2 SHF_EXECINSTR 0x4 SHF_MASKPROC 开发者_开发百科 0xf0000000
I have a series of bit flags that order something like {none=0x00, puppies=0x01, kittens=0x02, cute=0x04, funny=0x08, scary=0x10} and so forth.
What does applying [Flags] really do? I know it modifies the behavior of Enum.ToString, but does it do anything else? (e开发者_运维技巧.g. Different compiler or runtime behavior, etc.)
I am getting my bearings in core audio / audio units, so please forgive me if this should be self evident.
What would be the best way to send my bit flag to the fragment shader in order to be able to if() against it?
I am currently trying to use a bit flag enum in a VB6 / COM project. However, when trying to read values from the enum, I get inconsistent results.
Was looking at how enums can be used as bit flags by decorating them with the flags attribute and bitwize operators (see below).
Edit: It seems most people misunderstood my question. I know how enum works, and I know binary. I\'m wondering why the enums with the [Flags] attribute is designed the way it is.
I have a project where lots of the objects hold state by maintaining simple boolean flags.There are lots of these, so I maintain them within a uint32_t and use bit masking.There are now so many flags