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();
}
}
}