using System;
using System.Collections.Generic;
class MainClass
{
public static void Main()
{
ConsoleKeyInfo key;
Console.WriteLine("Process input until the user enters Alt-X or Alt-x");
do
{
key = Console.ReadKey(true);
Console.WriteLine(key);
if (key.Key == ConsoleKey.F1)
{
Console.WriteLine("F1");
}
// Handle backspace.
if (key.Key == ConsoleKey.Backspace)
{
Console.WriteLine("Backspace");
}
// Handle Escape.
else if (key.Key == ConsoleKey.Escape)
{
Console.WriteLine("Escape");
}
// Handle character input.
else if (key.Key >= ConsoleKey.A && key.Key <= ConsoleKey.Z)
{
Console.WriteLine(">=ConsoleKey.A && <= ConsoleKey.Z");
}
} while (key.Key != ConsoleKey.X || key.Modifiers != ConsoleModifiers.Alt);
}
}
Process input until the user enters Alt-X or Alt-x
System.ConsoleKeyInfo
=ConsoleKey.A && =ConsoleKey.A && =ConsoleKey.A && =ConsoleKey.A && =ConsoleKey.A && =ConsoleKey.A && =ConsoleKey.A && =ConsoleKey.A && =ConsoleKey.A &&