4つの可能なすべての矢印キーを押すためのこの列挙型があります
enum Direction{up=ConsoleKey.UpArrow, left=Consolekey.LeftArrow,...};
private ConsoleKeyInfo userSelect;
private bool mQuit;
私はそれから持っています
public void getUserInput()
{
userSelect = Console.ReadKey()
if (userSelect.Key == ConsoleKey.Escape)
{
mQuit = true;
}
else if(userSelect.Key == "check if key press is value in enumeration")
{
//implementation
}
}
「キーの押下が列挙型の値の1つであるかどうか」をチェックするためのコードが何であるかを理解できません。何かアイデアはありますか?