:
[Flags]
public enum MyButtons
{
None = 0
Button1 = 1,
Button2 = 2,
Button3 = 4,
Button4 = 8,
Button5 = 16,
Button6 = 32
}
- . 1 Button3 == 5
(|):
MyButtons SelectedButtons = MyButtons.Button1 | MyButtons.Button3
, , '' (&):
if (SelectedButtons & MyButtons.Button1 == MyButtons.Button1)...
, :
MyButtons.Button1 = 000001
MyButtons.Button3 = 000100
,
SelectedButtons = 000001 | 000100 = 000101
' MyButtons.Button1 - MyButtons.Button1:
IsButton1Selected = 000101 & 000001 = 000001