In my c# windows store app I have the following line of code to detect if the CTRL key is pressed. I got this code from an online sample, and it works perfectly.
var state = Window.Current.CoreWindow.GetKeyState(Windows.System.VirtualKey.Control);
if ((state & CoreVirtualKeyStates.Down) == CoreVirtualKeyStates.Down)
{
// do something with e.Key
}
Specifically, I've never seen the syntax in the if statement before.
+ is for adding ints or concatenating strings, and && is for combining 2 boolean expressions, so what does & do in this context?