Asynchronous events

  • Thread starter Thread starter Jeronimo Bertran
  • Start date 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
 
Back
Top