📜  Thread.Sleep() 不冻结 UI - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:16.447000             🧑  作者: Mango

代码示例1
private void someMethod()
  TO
 private async void someMethod()
 await Task.Delay(milliseconds);

This makes it an asynchronous method and will run asynchronously from your UI thread.
Note that this is only supported in the Microsoft .NET framework 4.5 and higher.