Aspdotnet-Suresh

aspdotnet-suresh offers C#.net articles and tutorials,csharp dot net,asp.net articles and tutorials,VB.NET Articles,Gridview articles,code examples of asp.net 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

C# - Output Console Window Closing Automatically without Showing Output

Sep 22, 2013
Introduction

Here I will explain how to show or display output console window in c#.net or how to solve the problem of closing output console window immediately in c#.

Description:

In previous articles I explained polymorphism example in c#, delegates in c# with example, Difference b/w compile time and runtime polymorphism, sealed classes in c#.net and many articles relating to c#, code snippets. Now I will explain how to solve the problem of closing output console window immediately in c#.

Show output console window

Generally whenever we run console applications once that execution finished automatically output window will close and return to application. In this situation if you want to show output window even if application execution finish we need to add Console.ReadLine()at the end of your code like as shown below


class Program
{
static void Main(string[] args)
{
Console.WriteLine("Welcome to Aspdotnet-Suresh.com");
Console.ReadLine();
}
}

I hope it helps you. Happy coding...

If you enjoyed this post, please support the blog below. It's FREE!

Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email

2 comments :

Anonymous said...

Sir,
I tried a simple console application program. But everytime i run the program, the output window pop ups and and shows blank but the program is correct with no errors.

piyush rai said...

try console.readkey()

Give your Valuable Comments

Note: Only a member of this blog may post a comment.

© 2015 Aspdotnet-Suresh.com. All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.