Menu

Async keyword alternative

Unfortunately, both MonoTouch and Mono for Android still don’t support the async keyword. Raw TPL is rather inconvenient to use. You have to remember to catch exceptions, return faulted tasks, etc. ContinueWith can also be inefficient due to thread switching.

Today while browsing the interwebs I came across Brad Wilson’s blog post which led me to these two files. TaskHelpers are (no pun intended) very very helpful! The extension methods emulate the await goodness pretty well.

I modified them a little bit. Here is a gist.