Hi,
I have created a delegate and I associated with multiple methods to that delegate. My requirement is on one invoking I have to trigger all the associated methods.
Here i saw all the methods are invoked but its not finished on the same time. Its running like a synchronous manner(because its running in a single threaded application).
Actually how the multicast delegate is invoking the associated methods in the background?
Display ddd=new Display(EventHandler);
ddd += EventHandler1;
ddd += EventHandler2;
ddd += EventHandler3;
ddd += EventHandler4;
ddd += EventHandler5;
.
.
.
.
ddd += EventHandlerXXX;
private static void EventHandler()
{
Console.WriteLine(DateTime.Now.ToString("yyyy.MM.dd HH:mm:ss:ffff"));
}
private static void EventHandler1()
{
Console.WriteLine(DateTime.Now.ToString("yyyy.MM.dd HH:mm:ss:ffff"));
}
private static void EventHandlerXXXX()
{
Console.WriteLine(DateTime.Now.ToString("yyyy.MM.dd HH:mm:ss:ffff"));
}
One scenario have a shopping site, multiple users are subscribed for the availability of a particular product. Once item is available I can notify using delegates/events. But how I can ensure everyone will notified exactly on the same time?