Asynchronous events

  • Thread starter Jeronimo Bertran
  • Start date
J

Jeronimo Bertran

I have an class that tiggers events using delegates... here is an example:

public delegate void RequestDelegate(object sender,Request request);

public class C1
{
public event RequestDelegate OnRequest;



protected void ProcessRequest(Request request)
{
if (OnRequest != null)
OnRequest(this, request);

Console.WriteLine("Request Sent");
}

}


public class C2
{
C1 c1 = new C1();


......
c1.OnRequest +=new RequestDelegate(OnRequest);



public void OnRequest(object sender, Request request)
{
// Perform operations....
Console.WriteLine("Request Processed");
}
}



now... When I send the request I don't want to wait for it to be
processed... I actually don't even care to be notified when it does....
Hense the output MIGHT come out as "Request Sent" followed by "Request
Processed"....

How can I send the event and not wait?

Thanks

Jeronimo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top