Monday, May 24, 2010

C# coding question (really easy)?

Trying to follow a tutorial but every time I debug/run a section of code it only appears on screen for a second. In the tutorial a msdos/cmd box appears but instead of ending it says 'press any key to continue'. Where can I toggle the option to fix this or what is the section of code needed to make a program wait for input before ending?

C# coding question (really easy)?
You can just put a Console.ReadLine(); statement at the end of your main() method to pause the program until the user presses the enter key.
Reply:Just Console.ReadLine() as the last line of your main() method:





main()


{


...............


...............


.


.


.


.


.





Console.ReadLine();


}


1 comment: