Should I always use Task.Delay instead of Thread.Sleep? [duplicate]
问题 This question already has answers here : When to use Task.Delay, when to use Thread.Sleep? (4 answers) Closed 4 years ago . I have recently seen several recommendations stating that Thread.Sleep should never be used in production code (most recently in this SO question). Many of these advocate for using Task.Delay instead. Most of the explanations I've found use UI applications as examples, since the advantages to Task.Delay are obvious (not blocking the UI). In my case, I am using Thread