I would like to ask how to do it in my console application in C# to program must wait 3 seconds. For example, the program displays the line Console.WriteLine("Hello!");
the program then wait 3 seconds and then writes the next line: Console.WriteLine("Welcome to my program.");
.
Asked
Active
Viewed 1.3k times
-6
-
8Possible duplicate of [Wait one second in running program](http://stackoverflow.com/questions/10458118/wait-one-second-in-running-program) – Thomas Weller Sep 18 '16 at 16:31
-
2Please check out https://www.google.com/search?q=cgoogle&ie=&oe=#q=cgoogle+c-sharp+delay+program+execution and be sure to search for solutions both in Google and in SO before posting a new question - many times the answer is right there waiting for you! – Shannon Holsinger Sep 18 '16 at 16:37
-
You use the term "set timeout"... is your background in Javascript, are you asking for a C# equivalent of Javascripts `setTimeout` function? – MattDavey Sep 18 '16 at 17:26
1 Answers
4
This can be done by:
Console.WriteLine("Hello!");
System.Threading.Thread.Sleep(3000);
Console.WriteLine("Welcome to my program.");

Fka
- 6,044
- 5
- 42
- 60