public Task <TRequest> ReadNext() { var taskSource = new AsyncCompletionTaskSource <TRequest>(); call.StartReadMessage(taskSource.CompletionDelegate); return(taskSource.Task); }
public async Task <bool> MoveNext(CancellationToken token) { if (token != CancellationToken.None) { throw new InvalidOperationException("Cancellation of individual reads is not supported."); } var taskSource = new AsyncCompletionTaskSource <TRequest>(); call.StartReadMessage(taskSource.CompletionDelegate); var result = await taskSource.Task.ConfigureAwait(false); this.current = result; return(result != null); }