I have to build an extension method for each flag type I declare, like so:
public static EventMessageScope SetFlag(this EventMessageScope flags,
EventMe
The &
operator will give you the same answer with a & b
as it will with b & a
, so
(EventMessaageScope.Private).Get(EventMessageScope.Private | EventMessageScope.PublicOnly)
is the same as writing
(EventMessageScope.Private | EventMessageScope.PublicOnly).Get(EventMessaageScope.Private)
If you just want to know if the value is the same as EventMessaageScope.Public, then just use equals:
EventMessageScope.Private == EventMessageScope.Public
Your method will always return false
for (EventMessageScope.None).Get(EventMessaageScope.None)
because None == 0
and it only returns true when the result of the AND operation is not zero. 0 & 0 == 0
.