How do I pause a console app in c# so the window stays open until the user presses enter or something.
I have just started c#...
How do I pause a console app in c# so the window stays open until the user presses enter or something.
I have just started c#...
umm sory those are for c++ and don't work in c#...
oh, my mistake . I don't know all the differences between C++ and C#, I'll look them up.
I just use:
Its exactly the same principle as in C++ etc.Code:Console.ReadLine();
That'll work for pressing enter (which I believe is what you originally asked for), but you can also get it to return on a keypress by using Console.Read(). If I remember correctly this will actually return an integer which will need to be typecasted to a char for data processing, but if you're just pausing, a simple call to Console.Read()'ll do the trick.
thanks I can actually do some stuff now!
the read or readline functions didn't work.
And don't worry I know how they work I got a really nice c# book and it taught me that capitals matter and so on. So I garantee you I did put them in corectly and it did compile, but it still didn't pause.