C# do while Enter uppercase and lowercase letters in a string
06:19 10 Jun 2018

C# do while question.

What I want is the ability to terminate Q or q in upper case, lowercase letters in the source code.

I referenced MSDN but it did not work out, so I have a question here.

using System;

namespace Try
{
    class Program
    {
        static void Main(string[] args)
        {
            string str1 = "Q";
            string str2 = "q";

            if (str1.Equals(str2, StringComparison.OrdinalIgnoreCase)) { }

            string menu = "";

            do
            {
                Console.WriteLine("Select Meun:(1)Triangle (2)Rectangle " +
                                  "(Q)Quit",string.Equals
                                  (str1, str2, StringComparison.CurrentCultureIgnoreCase));

                menu = Console.ReadLine();

                Console.WriteLine(menu + "is selected");
            } while (menu != "Q");
        }
     }
}
c# do-while