Answers for "c# how to get key input without block"

C#
0

c# how to get key input without block

static void Main(string[] args)
        
        {
            while(true)
            {
                Console.WriteLine(DateTime.Now.ToString("HH:mm:ss"));
                if(Console.KeyAvailable)
                {
                    ConsoleKeyInfo key = Console.ReadKey();
                    Console.WriteLine("Read key: "+key.KeyChar);
                }
                Thread.Sleep(500);
            }
        }
Posted by: Guest on August-08-2020

C# Answers by Framework

Browse Popular Code Answers by Language