예제 #1
0
        /// <summary>
        /// Gets a yes or no answer from the user.
        /// </summary>
        /// <param name="prompt">
        /// Displays the prompt.
        /// </param>
        /// <returns>
        /// True if the user answered yes and false if he or she answered no.
        /// </returns>
        public static bool GetYesOrNo(Action prompt)
        {
            prompt();

            var response = default(char);

            do
            {
                response = Console.ReadKey(intercept: true).KeyChar;
            }while (response != '0' && response != '1');

            View.ShowChar(response);
            return(response == '1');
        }