Skip to Main Content
Microsoft .NET Framework 4.5 Quickstart Cookbook
book

Microsoft .NET Framework 4.5 Quickstart Cookbook

by Jose Luis Latorre
May 2013
Intermediate to advanced content levelIntermediate to advanced
226 pages
4h 16m
English
Packt Publishing
Content preview from Microsoft .NET Framework 4.5 Quickstart Cookbook

Understanding async and await in .NET 4.5

The new asynchronous capabilities of .NET 4.5 rely on the async and await modifiers. Basically we have two important points here:

  • The async modifier indicates to the compiler that a method or lambda expression is asynchronous—we call them async methods.
  • The await operator, which can only be used within an async method, is applied to a task to suspend execution of the method until the task is complete. Meanwhile, the control is returned to the caller of that method.

How to do it...

Here we will use the async and await features in a basic way to clearly understand them.

  1. Create a new Visual Studio project of type Console Application named caAsyncAwait.
  2. Add a reference to the System.Net.Http assembly.
  3. In the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

.NET Core 2.0 By Example

.NET Core 2.0 By Example

Neha Shrivastava, Rishabh Verma
Introducing .NET 4.5

Introducing .NET 4.5

Alex Mackey, William Tulloch, Mahesh Krishnan
ASP.NET 4 Unleashed

ASP.NET 4 Unleashed

Stephen Walther, Kevin Hoffman, Nate Dudek
Microsoft® .NET Compact Framework (Core Reference)

Microsoft® .NET Compact Framework (Core Reference)

Andy Wigley, Stephen Wheelwright, Robert Burbidge, Rory MacLoed, Mark Sutton

Publisher Resources

ISBN: 9781849686983Other