It is not clear what it is that you find obscure, so let's discuss all of this:
The enumeration values contain explicit numerical values. Each enumeration value is always represented as a numeric value for the underlying storage, but if you want to be sure that this is a numeric value, you must specify it.
The numbers are written in hexadecimal, this is often used when you want numeric values to contain one bit of the masking kit. It is easier to see that only one bit is set when it is written as 0x8000, than when it is written as 32768.
In your example, this is not so obvious, since you have only two values, but for filtering by bits, each value represents one bit, so each value is two times larger than the previous one:
public enum Filter { First = 0x0001, Second = 0x0002, Third = 0x0004, Fourth = 0x0008 }
You can use this enumeration to filter out individual bits in a value:
If ((num & Filter.First) != 0 && (num & Filter.Third) != 0) { Console.WriteLine("First and third bits are set."); }
Guffa source share