Subscribe to our YouTube Channel for more Videos

Visual Studio 2013 Tips & Tricks – Waiting for a Keystroke before the Console Windows Closes without using Console.ReadLine


This trick is applicable not just for Visual Studio 2013 but also for the previous versions of the Visual Studio. By default, when you run a Console Application in Visual Studio by pressing the F5 key, the output or the console window closes quickly before you actually get a chance to read it.

One of the simplest way to solve this issue is to use the Console.ReadLine (); placed at the end of the Main method.

One of the other technique which works without using the Console.ReadLine is using the Start without Debugging option.

Visual Studio 2013 Tips & Tricks - Waiting for a Keystroke before the Console Windows Closes without using Console.ReadLine

When using the Ctrl + F5 (Start without Debugging), the console window appears but it would wait for the key press for it to close.

Visual Studio 2013 Tips & Tricks - Waiting for a Keystroke before the Console Windows Closes without using Console.ReadLine

Senthil Kumar B
Senthil Kumar is a former Microsoft MVP (Most Valuable Professional). He is a Co-Author of the book "Windows 10 Development Recipes using JavaScript and CSS" for Apress Publication. He is a technical presenter, blogger, mentor and a Geek.  Senthil is a regular speaker is various local user groups. He has presented at conferences like Great Indian Developer Summit (GIDS) & Microsoft DevCamps. You can reach out to him via his Twitter handle @isenthil.