Sunday, November 29, 2015

MonoDevelop/C# to keep console open with ReadKey()


In C# console program, we can keep console open by inserting the code Console.ReadKey():
using System;

namespace HelloWorldCsharp
{
    class MainClass
    {
        public static void Main (string[] args)
        {
            Console.WriteLine ("Hello World!");
            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
        }
    }
}