New with c#

  • Thread starter Thread starter Martin VavpotiÄ
  • Start date Start date
M

Martin VavpotiÄ

Hello. I have recently begun to program with c#. I've done some
programming with Java before so I'm not a total noob but I do have
some questions.

I use Textpad to compile the code and that generates an .exe file.
When I double-click that or use Run option of Windows, I see a MS Dos
Prompt for a milisecond. I need to make the Prompt Window to stay open
until I close it. How do I do that?
 
Hello. I have recently begun to program with c#. I've done some
programming with Java before so I'm not a total noob but I do have
some questions.

I use Textpad to compile the code and that generates an .exe file.
When I double-click that or use Run option of Windows, I see a MS Dos
Prompt for a milisecond. I need to make the Prompt Window to stay open
until I close it. How do I do that?

static void Main(string[] args)
{
....
// put a prompt to the console
Console.WriteLine("\n\tHit any key to exit");
// wait for the any key
while (Console.ReadKey() == null) ;
}

regards
A.G.
 
Hello. I have recently begun to program with c#. I've done some
programming with Java before so I'm not a total noob but I do have
some questions.

I use Textpad to compile the code and that generates an .exe file.
When I double-click that or use Run option of Windows, I see a MS Dos
Prompt for a milisecond. I need to make the Prompt Window to stay open
until I close it. How do I do that?

static void Main(string[] args)
{
....
// put a prompt to the console
Console.WriteLine("\n\tHit any key to exit");
// wait for the any key
while (Console.ReadKey() == null) ;
}

Just:

Console.ReadKey();

should be fine.

ReadKey is blocking.

Arne
 
Back
Top