-6

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.");.

Jim G.
  • 15,141
  • 22
  • 103
  • 166
Ronte
  • 9
  • 1
  • 1
  • 3
  • 8
    Possible 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
  • 2
    Please 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 Answers1

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