Skip to content

C# Task.Delay() 和 Thread.Sleep() 区别

L edited this page Aug 30, 2021 · 1 revision

摘抄自C# Task.Delay() 和 Thread.Sleep() 区别

Use Thread.Sleep when you want to block the current thread. 要阻止当前线程时,请使用Thread.Sleep

Use Task.Delay when you want a logical delay without blocking the current thread. 如果需要逻辑延迟而不阻塞当前线程,请使用Task.Delay

Clone this wiki locally