I have seen many times the use of bitwise or in enumerations but I was wondering how they work as I have the following.
public enum Flags
{
Flag1=0,
Flag2=1,
Flag3=2
}
Protected void Check()
{
Flags f = Flags.Flag1 | Flags.Flag2;
}
However if I check "f" it is set to Flags.Flag2 and therfore if I check if it is equal to Flags.Flag1 then it returns false.
How is this supposed to work as I assumed f would equal both Flags.Flag1 or Flags.Flag2?
...
Go to the complete details ...