.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> Performace >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Asynchronous programming by delegates

Posted By:nishithraj       Posted Date: November 27, 2009    Points: 10    Category: Performace    URL: http://www.dotnetspark.com  
 

Asynchronous programming provides parallel activities through a same program. Delegates is used to achieve this in dotnet. AsyncCallback is used to call the next action when a an asynchronous action finishes.

Using Delegates we can do asynhronous programming. That's an advantage of delegates.


public delegate double AsyncDelegate(int x,int y);
public class Mediator{
public static void Main(String[] args){
Calculator obj= new Calculator();
AsyncDelegate dlgt = new AsyncDelegate(obj.Add);
//Declare Asynchronous call back object to perform asynchronous actions
//Delegate points to the method callme
AsyncCallback acb=new AsyncCallback(Mediator.callme);
//BeginInvoke method calling -- it's available in System.Windows.Threading
IAsyncResult

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend