console appliction in c#.net

i have to print a statemanet in command prompt by using c#.net console

Page 1 of 1

1 Replies - 1327 Views - Last Post: 06 November 2008 - 12:00 AM Rate Topic: -----

#1 tejapasupuleti   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 05-November 08

console appliction in c#.net

Post icon  Posted 05 November 2008 - 11:52 PM

using  System;
class sample 
	{
		static void Main(string[] args)
		{
		 Console.WriteLine("this is sample program");
		  }
	  }



BY this code i have got out put in command prompt, but the problem is:
command prompt is closing as soon as it has opend.my requirement is it should not close till i close.
Is This A Good Question/Topic? 0
  • +

Replies To: console appliction in c#.net

#2 PsychoCoder   User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1663
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: console appliction in c#.net

Posted 06 November 2008 - 12:00 AM

Try adding Comsole.ReadKey, something like this

using  System;
class sample
{
        static void Main(string[] args)
        {
              Console.WriteLine("this is sample program");
              Console.ReadKey();
         }
}     



Hope this helps :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1