如何在 mac 上使用 C# 检测间隔条是否为 typed/Pressed?

How do I detect if the spaced bar is typed/Pressed using C# on mac?

我正在编写一个程序,如果按下 space 键,它就会执行某些操作。 我到目前为止:

  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");
}