+ 1

how can I set timer in c#?

Hello friends. I have been trying to do something for some time, but I did not find any results by searching. Please explain to me how to define a code that happens after something happens, for example 300 milliseconds later. Please suggest a code that is not interrupt but just a timer. Also please send concept code. Thankful

5th Dec 2021, 1:09 PM
Alireza Zeinali
Alireza Zeinali - avatar
2 odpowiedzi
+ 2
using System; using System.Threading; class JaScript { static void Main() { for (int i = 0; i < 5; i++) { Console.WriteLine("Sleep for 1 second."); Thread.Sleep(1000); } Console.WriteLine("Main thread exits."); } }
5th Dec 2021, 3:09 PM
JaScript
JaScript - avatar
7th Dec 2021, 11:53 PM
Eymerich