Just Beautiful … going from (HttpWebRequest / HttpWebResponse / Actions / IAsyncResult / AsyncCallback) to (HttpClient / Task / Async / Await)


image

So I’m doing some coding for a library that I hope to release soon that will give you all the important plumbing for making Twitter calls for WinRT apps. It leverages ideas from the Flickr library I recently updated for WinRT a couple of posts ago.

This time however I planned to re-write the plumbing to use more native WinRT concepts like the Async/Await pattern.

The networking libraries that we’ve all become accustomed to are the HttpWebRequest / HttpWebResponse which uses IAsyncResult/AsyncCallback and Actions, however these aren’t wired up to take advantage of the async/await pattern.

The equivalent of these networking libraries that does have the async/await pattern built in is the HttpClient.

So I rewrote some key low level methods to use this new class and leverage the new async/await pattern… It was a beautiful experience, the pattern and the class definitely have become a favorite of mine !!

(click picture to see the larger more visible code bits)

image

One response to “Just Beautiful … going from (HttpWebRequest / HttpWebResponse / Actions / IAsyncResult / AsyncCallback) to (HttpClient / Task / Async / Await)

  1. Pingback: Just Beautiful … going from (HttpWebRequest / HttpWebResponse / Actions / IAsyncResult / AsyncCallback) to (HttpClient / Task / Async / Await) | Silverlight and other cool things …

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s