main - best opening for key listening


This is the best loop to see if user keyed in and escape character or actual data : -


      Console.WriteLine("Press ESC to stop or enter valuation date: (2018-01-01)");
            do
            {               
                while (!Console.KeyAvailable)
                {
                    var valuationDate = Console.ReadLine();
                    Console.WriteLine(valuationDate + "entered");                 

                }
            } while (Console.ReadKey(true).Key != ConsoleKey.Escape);
        }


Comments

Popular posts from this blog

ionic2 cordova build android - Unable resolve gradle 2.2.3

A quick tutorial for OWASP ZAP tool for beginners