Skip to content

Instantly share code, notes, and snippets.

@peteraritchie
Created February 22, 2012 15:32
Show Gist options
  • Save peteraritchie/1885565 to your computer and use it in GitHub Desktop.
Save peteraritchie/1885565 to your computer and use it in GitHub Desktop.
beginendtpl
var task = Task.Factory.FromAsync(networkStream.BeginWrite,
networkStream.EndWrite,
data, 0, data.Length,
networkStream);
Task<Task<int>> task2 = task.ContinueWith(_ => Task<int>.Factory.FromAsync(
networkStream.BeginRead,
networkStream.EndRead,
incomingData, 0,
incomingData.Length,
networkStream));
task2.ContinueWith(priorTask => Console.WriteLine("{0} bytes read", priorTask.Result.Result));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment