如何将接受回调函数作为参数的现有异步方法包装到与任务并行库兼容的方法中?
// Existing method
void DoAsync(Action<string> callback) {
...
}
// The desired method should have similar prototype
Task<string> DoAsync() {
// Internally this method should call existing
// version of DoAsync method (see above)
}