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

The specified initialization vector (IV) does not match the block size for this algorithm