I am writing a program that will do something if the space key is pressed. I have so far :
Console.WriteLine("Listening for the BIG BUTTON:......... ");
ConsoleKeyInfo name = Console.ReadKey();
Console.WriteLine("You pressed {0}", name.KeyChar);
if(//keyPressed is the spacekey" ){
Console.WriteLine("Space key is pressed);
}
https://msdn.microsoft.com/en-us/library/system.consolekey(v=vs.110).aspx
Console.WriteLine("Listening for the BIG BUTTON:......... ");
ConsoleKeyInfo name = Console.ReadKey();
Console.WriteLine("You pressed {0}", name.KeyChar);
if(name.Key == ConsoleKey.Spacebar )
{
Console.WriteLine("Space key was pressed");
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.