标签: c# .net multithreading .net-core
我将库移植到.NET核心并最大化可移植性我需要消除对System.Threading.Thread的依赖,因此消除对Thread.Sleep的依赖。什么是替代品?
答案 0 :(得分:36)
you can use Task.Delay(2000).Wait(); // Wait 2 seconds with blocking await Task.Delay(2000); // Wait 2 seconds without blocking