CSharp examples for Thread Asynchronous:Async
Simple Async Method
using System;/*w w w .j a v a 2 s .com*/ using System.ComponentModel; using System.Threading.Tasks; class SimpleAsyncMethod { static async Task PrintAndWait(TimeSpan delay) { Console.WriteLine("Before first delay"); await Task.Delay(delay); Console.WriteLine("Between delays"); await Task.Delay(delay); Console.WriteLine("After second delay"); } static void Main() { PrintAndWait(TimeSpan.FromSeconds(1)).Wait(); } }