When to use Task.Delay, when to use Thread.Sleep in C#?
Thread.Sleepwhen you want to block the current thread.
Task.Delaywhen you want a logical delay without blocking the current thread.
The biggest difference between
Task.Delayis intended to run asynchronously. It does not make sense to use
Task.Delayin synchronous code. It is a VERY bad idea to use
Thread.Sleepin asynchronous code.