Ronte Ronte - 2 months ago 7
C# Question

How to set timeout in C#

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

Fka Fka
Answer

This can be done by:

Console.WriteLine("Hello!");
System.Threading.Thread.Sleep(3000);
Console.WriteLine("Welcome to my program.");