Advertisement
wingman007

NonBlockingLoop

May 29th, 2017
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.68 KB | None | 0 0
  1.             ConsoleKeyInfo cki;
  2.  
  3.             do
  4.             {
  5.                 // cki = Console.ReadKey(true);
  6.                 // ConsoleKeyInfo cki;
  7.                 Console.WriteLine("I am in a thred!");
  8.                 if (Console.KeyAvailable)
  9.                 {
  10.                     cki = Console.ReadKey(true);
  11.                     if (cki.Key == ConsoleKey.Escape) break;
  12.  
  13.                     switch (cki.Key) {
  14.                         case ConsoleKey.RightArrow:
  15.                             Console.WriteLine("RightArrow");
  16.                             break;
  17.                     }
  18.                 }
  19.                 System.Threading.Thread.Sleep(150);
  20.             } while (true);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement