Wrapping your brain around Async and Await in C#

Follow along @ http://fammy.github.io/async

Jason Famularo

jason@famularo.org or @splodn

Stop me and ask questions! (Although I may save them for the end)

What is Async?

What is Async?

Synchronous: run code in order, from top to bottom, one statement at a time

Asynchronous: (potentially) run multiple code statements at once

Why do we need async?

  • Asynchronous programming has traditionally been really, really hard
  • Keeps UI from being blocked on long running tasks
  • Lots of newer APIs are async
  • Mobile OSes disallow networking to run on UI thread

How do you async in C#?

Let's look at some code

Exception handling

Async greatly simplifies exception handling

Common Pitfalls

  • Not asyncing all the things!
  • Avoid "async void". At almost all costs.

Questions?

Ask away!


Jason Famularo

jason@famularo.org or @splodn