Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Async Code Wrangling

Async Code Wrangling

Introduction to making your code asynchronous. Demo C# code available via GitHub repo (https://github.com/patridge/demos-asynchronous-csharp/). Demo code was entirely live-coded, but the repo expresses all the same concepts.

patridge

April 15, 2014
Tweet

More Decks by patridge

Other Decks in Programming

Transcript

  1. Async when? • Network access • File access • Accessing

    anything slow/unreliable • Animations • User interactions
  2. Promises[/Deferreds/Tasks] An interface for working with a value without knowing

    (or caring) what it will be, where it will come from, or even if it will come back successfully.
  3. Async in .NET .NET 1.0: Async Pattern (Begin/End) .NET 2.0:

    Event-based Async Pattern (Callback) .NET 4.0: Task Parallel Library .NET 4.5: async/await
  4. C# async/await Another layer beyond Tasks. Makes it easier to

    write asynchronous code. Compiler handles all the magic for you.
  5. Other Resources • Lucian Wischik's blog/videos (blogs.msdn.com/b/lucian/) • MSDN: Best

    Practices in Asynchronous Programming (http://msdn.microsoft.com/en-us/magazine/jj991977. aspx) • Various TechEd/Build talks on Channel9 • Microsoft Async for async/await in VS 2012 (https: //www.nuget.org/packages/Microsoft.Bcl.Async) @patridgedev patridgedev.com