The state value is an enumeration of the flag - this means that different bits in it mean different things, and you can combine them to tell you a few things about the state. for instance
[Flags] public enum States { Selected = 1; OnScreen = 2; Purple = 4; }
So, if you want to see that something is selected, you cannot just compare it with the selected one (see if it has an int 1 value), since it can be selected both on the screen and on the screen (and it will have an int value of 3). Performing a bitwise comparison, you check to see if the Selected check box is selected, ignoring the meaning of other flags.
source share