public void Action() { var request = new Request(); request.BeginOperation( result => { Callback(result, request); }, request); }
private async void Callback2(Task<Response> task, Request request) { var response = await SharedCode(task).ConfigureAwait(false); }
public void Action2() { var request = new Request(); var task = request.OperationAsync(); Callback2(task, request); }
public void Action2() { var request = new Request(); request.BeginOperation(Callback2, request); }
private void Callback(Task<Response> task, Request request) { var response = task.GetAwaiter().GetResult(); }
public void Action() { var request = new Request(); var task = request.OperationAsync() .ContinueWith(t => Callback(t, request)); }
private void Callback(IAsyncResult result, Request request) { var response = request.EndOperation(result); }
public void Action() { var request = new Request(); request.BeginOperation(result => Callback(result, (Request)result.AsyncState), request); }
private async Task Callback(Task<Response> task, Request request) { var response = await task.ConfigureAwait(false); }
public IAsyncResult BeginOperation(AsyncCallback callback, Request request) { throw new NotImplementedException(); }
public async Task Action() { var request = new Request(); var task = request.OperationAsync(); await Callback(task, request); }