Answers for "c# put code to sleep for x seconds"

C#
4

c# async sleep

// Async
await Task.Delay(1000); //when you want a logical delay without blocking the current thread
// Not Async
Thread.Sleep(1000) //when you want to block the current thread.
Posted by: Guest on August-22-2020
1

sleep in C#

System.Threading.Thread.Sleep(50); //will sleep for 50ms
Posted by: Guest on December-02-2021

C# Answers by Framework

Browse Popular Code Answers by Language