check specific key input c# code example
Example 1: c sharp check if key in dictionary
// To check if a dictionary has a certain key, use 'ContainsKey()'
dict.ContainsKey(key);
Example 2: how to detect if a key is pressed in c#
//...
using System.Windows.Input;
class Main {
public void Main() {
while(true) {
if(Keyboard.IsKeyPressed(Key.A)) {
//...
}
return;
}
}
}