Skip to content

Instantly share code, notes, and snippets.

@Redth
Created June 12, 2014 17:56
Show Gist options
  • Select an option

  • Save Redth/03638f20639c7e513ccb to your computer and use it in GitHub Desktop.

Select an option

Save Redth/03638f20639c7e513ccb to your computer and use it in GitHub Desktop.
var http = new HttpClient ();
// This is sorta node.js like with a 'callback' or continuation after the async operation completes:
http.GetStringAsync ("https://google.com")
.ContinueWith (t => {
var html = t.Result;
Console.WriteLine (html);
});
// This is the same thing:
var html = await http.GetStringAsync ("https://google.com");
Console.WriteLine (html);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment