Skip to main content

Posts

Showing posts from September, 2011

C# 5.0: Asynchronous Operations

  Asynchronous functions: is a new feature in C# which provides an easy means for expressing asynchronous operations. Inside asynchronous functions await expressions can await ongoing tasks, which causes the rest of the execution of the asynchronous function to be transparently signed up as a continuation of the awaited task. In other words, it becomes the job of the programming language, not the programmer, to express and sign up continuations. As a result, asynchronous code can retain its logical structure. An asynchronous function is a method or anonymous function which is marked with the async modifier. A function without the async modifier is called synchronous. An asynchronous function in C# must either return void or one of the types Task or Task . Await expressions: Await expressions are used to suspend the execution of an asynchronous function until the awaited task completes. An await expression is only allowed when occurring in the body of an asynchronous function. I...