.NET 4.5 has new keywords await and async

The .NET Framework 4.5 introduced an asynchronous programming concept referred to as a task. The await keyword is syntactical shorthand for indicating that a piece of code should asynchronously wait on some other piece of code. The async keyword represents a hint that you can use to mark methods as task-based asynchronous methods. A scenario like a report method should be executed asynchronously an dinside the method, fetching DB information should be synchronized. Here's how it should display

private async Task ShowReport() 
    var result = await DB.ExecuteNonQuery(<<some SP>>); 
// Code to handle the report display

Above, bolded words are key. It's saying ShowReport() will execute as async, but DB operation inside it will be synchronized.

See here http://msdn.microsoft.com/en-us/library/hh191443(v=vs.110).aspx more info.
Ebook Download
View all
View all