Example for Asynchonous Delegates

Posted by Manimaddu under C# category on | Points: 40 | Views : 788
Hi all...

The below code is example for Asynchonous Delegate

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;

namespace AsynchonousDelegateDemo
public class DelegateDemo4
delegate Guid DoComplexLogic();
public static void Main(string[] args)
DoComplexLogic docomplexLogic = MyComplexLogic;
docomplexLogic.BeginInvoke(new AsyncCallback(CallBackMyComplexTask), docomplexLogic);
Console.WriteLine("New task is started!");
public static void CallBackMyComplexTask(IAsyncResult asyncResult)
DoComplexLogic doComplexLogic = (DoComplexLogic)asyncResult.AsyncState;
Guid newGuid = doComplexLogic.EndInvoke(asyncResult);
public static Guid MyComplexLogic()
Console.WriteLine("BigTask Completed...");
return Guid.NewGuid();

Thank you..

Comments or Responses

Login to post response