C# Help - program closing quickly

Started by
5 comments, last by Physics515 19 years, 1 month ago
When I run the Hello World it closes very quickly in a matter of seconds. Im using Visual C# 2005 Express Edition Beta. my code is this:

using System;

public class HelloWorld
{
    public static void Main()
    {
        Console.WriteLine("Hello World!!!");

    }
}

Please show me how to make the window stay, and please explain your code.
Advertisement
Start your program with Ctrl+F5, and the console will remain open until you press a key.

Cheers
~matt();
using System;public class HelloWorld{    public static void Main()    {        Console.WriteLine("Hello World!!!");        Console.ReadKey();    }}

In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.

Quote:Original post by matthias6S
Start your program with Ctrl+F5, and the console will remain open until you press a key.

Cheers
~matt();


For a VS C++, yes. For VS C#, no. Still haven't found the flag to make it behave that way, and afaik, there isn't one.

In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.

Quote:Original post by WashuFor a VS C++, yes. For VS C#, no. Still haven't found the flag to make it behave that way, and afaik, there isn't one.

It works for me with 7.0 and 7.1. I just verified it.

~matt();
7.0 and 7.1 are NOT Visual Studio 2005. They are also certainly NOT Visual C# 2005 Express.

Yes, in 7.0 and 7.1 when you run a C# application, it will remain open after the application has finished (just like a C++ application). However, this is not so in 2005, as far as my experiances have gone.

In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.

One way to stop this from happening is to open the program from the command prompt or you can "Console.ReadLine();" after the WriteLine.

This topic is closed to new replies.

Advertisement