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)");
                while (!Console.KeyAvailable)
                    var valuationDate = Console.ReadLine();
                    Console.WriteLine(valuationDate + "entered");                 

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


Popular posts from this blog

Solving Sonarqube :- Project was never analyzed. A regular analysis is required before a branch analysis

spark - pyspark reading from excel files