Jump to content
  • Advertisement
Sign in to follow this  

C# Help - program closing quickly

This topic is 4814 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement

using System;

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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();

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!