G
Guest
I have multiple Keys enumeration variables (they are, I believe, internally
ints). Let's say I have 3 variables created in C# is follows:
Keys K1 = Keys.S | Keys.Control;
Keys K2 = Keys.S | Keys.Shift | Keys.Control;
Keys K3 = Keys.S | Keys.Shift | Keys.Control | Keys.Alt;
Now, let's say, I want to have a function which, regardless of what Keys
variable I am passed, will return a Keys value WITHOUT any Keys.Control,
Keys.Alt, or Keys.Shift. In other words, for all of the variables above (K1,
K2, K3), the function would simply return Keys.S only. I know that doing this
requires some kind of bit-wise operation but I can't seem to figure it out.
Help?
Alex
ints). Let's say I have 3 variables created in C# is follows:
Keys K1 = Keys.S | Keys.Control;
Keys K2 = Keys.S | Keys.Shift | Keys.Control;
Keys K3 = Keys.S | Keys.Shift | Keys.Control | Keys.Alt;
Now, let's say, I want to have a function which, regardless of what Keys
variable I am passed, will return a Keys value WITHOUT any Keys.Control,
Keys.Alt, or Keys.Shift. In other words, for all of the variables above (K1,
K2, K3), the function would simply return Keys.S only. I know that doing this
requires some kind of bit-wise operation but I can't seem to figure it out.
Help?
Alex