using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; namespace AsyncDelegatesExample { class Program { public delegate int SomeOperation(int i); static int DoSomething(int i) { //something time consuming here Thread.Sleep(5500); return 2 * i; } static void Main(string[] args) { SomeOperation so = DoSomething; IAsyncResult iar = so.BeginInvoke(8, null, null); Console.WriteLine("Method executed"); WaitHandle. Thread.Sleep(1000); while (!iar.IsCompleted) { Console.WriteLine("Method DoSomething has not finished yet"); Thread.Sleep(1000); } Console.WriteLine("Method DoSomething has finished with result {0}", so.EndInvoke(iar)); } } }