我怎么能转换方法:
static void DoWork(Action<bool> onCompleteCallback)
{
Task doWork = new Task( ()=>Thread.Sleep(2000) );
Action<Task> onComplete = (task) => {
onCompleteCallback(true); // should execute on the main thread
};
doWork.ContinueWith(onComplete, TaskScheduler.FromCurrentSynchronizationContext());
doWork.Start();
}
到异步。
如果我将其转换为 Async 会有什么区别?