how To check if CTRL key is pressed in console application c#
问题 I'm Going to start a console application. The problem is how to determine that the CTRL key is pressed alone without any other key. using System; using System.Text; public class ConsoleKeyExample { public static void Main() { ConsoleKeyInfo input; do { input = Console.ReadKey(true); StringBuilder output = new StringBuilder(String.Format("You pressed {0}",input.Key.ToString())); Console.WriteLine(output.ToString()); if ((input.Modifiers & ConsoleModifiers.Control) != 0) { Console.WriteLine(