Q:

C# Console app, Can't keep program running in while loop

I am trying to change Console color when user press certain keys, but I doing something wrong in while loop. try break and return, but both does not work for me. I still new to coding. 
    static void Main(string[] args)
    {

        while (true )
        {Console.WriteLine("Press Key R,G,B,D,C,M to change Console Color");
            Console.ReadLine();

            if (Console.ReadKey(true).Key == ConsoleKey.R)
            {
                Console.BackgroundColor = ConsoleColor.Red;
                Console.ForegroundColor = ConsoleColor.Black;
                Console.Clear();
                //Console.WriteLine("Press Key R,G,B,D,C,M to change Console Color");
               break;
            }

            else if (Console.ReadKey(true).Key == ConsoleKey.G)
            {
                Console.BackgroundColor = ConsoleColor.Green;
                Console.ForegroundColor = ConsoleColor.Black;
                Console.Clear();
                Console.WriteLine("Press Key R,G,B,D,C,M to change Console Color");
                //break;
            }

            else if (Console.ReadKey(true).Key == ConsoleKey.B)
            {
                Console.BackgroundColor = ConsoleColor.Blue;
                Console.ForegroundColor = ConsoleColor.Red;
                Console.Clear();
               Console.WriteLine("Press Key R,G,B,D,C,M to change Console Color");
                //return;
            }

            else if (Console.ReadKey(true).Key == ConsoleKey.D)
            {
                Console.BackgroundColor = ConsoleColor.DarkGreen;
                Console.ForegroundColor = ConsoleColor.White;
                Console.Clear();
                Console.WriteLine("Press Key R,G,B,D,C,M to change Console Color");
              // break;
            }

            else if (Console.ReadKey(true).Key == ConsoleKey.C)
            {
                Console.BackgroundColor = ConsoleColor.Cyan;
                Console.ForegroundColor = ConsoleColor.DarkRed;
                Console.Clear();
               Console.WriteLine("Press Key R,G,B,D,C,M to change Console Color");
               // break;
            }

            else if (Console.ReadKey(true).Key == ConsoleKey.M)
            {
                Console.BackgroundColor = ConsoleColor.Magenta;
                Console.ForegroundColor = ConsoleColor.Black;
                Console.Clear();
                Console.WriteLine("Press Key R,G,B,D,C,M to change Console Color");
              //  break;
            }

            else {
                Console.WriteLine("You didn't press Key R,G,B,D,C,M.");
              //Console.ReadLine();
               // return;
            }
         // Console.ReadLine(); 

        }      
    }
}

}

A:

Your code was not working because: you were first expecting the user to input a line and then a key.
Second: if the user pressed r the while loop would break.
You should read the key before you start checking the user input because on every if you were expecting a new key press.
   while(true)
            {
                Console.WriteLine("Press Key R,G,B,D,C,M to change Console Color");

                var key = Console.ReadKey();
                if (key.Key == ConsoleKey.R)
                {
                    Console.BackgroundColor = ConsoleColor.Red;
                    Console.ForegroundColor = ConsoleColor.Black;
                    Console.Clear();
                }

                else if (key.Key == ConsoleKey.G)
                {
                    Console.BackgroundColor = ConsoleColor.Green;
                    Console.ForegroundColor = ConsoleColor.Black;
                    Console.Clear();
                }

                else if (key.Key == ConsoleKey.B)
                {
                    Console.BackgroundColor = ConsoleColor.Blue;
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.Clear();
                }

                else if (key.Key == ConsoleKey.D)
                {
                    Console.BackgroundColor = ConsoleColor.DarkGreen;
                    Console.ForegroundColor = ConsoleColor.White;
                    Console.Clear();
                }

                else if (key.Key == ConsoleKey.C)
                {
                    Console.BackgroundColor = ConsoleColor.Cyan;
                    Console.ForegroundColor = ConsoleColor.DarkRed;
                    Console.Clear();
                }

                else if (key.Key == ConsoleKey.M)
                {
                    Console.BackgroundColor = ConsoleColor.Magenta;
                    Console.ForegroundColor = ConsoleColor.Black;
                    Console.Clear();
                }

                else
                {
                    Console.WriteLine("You didn't press Key R,G,B,D,C,M.");
                }

            };

