Josh you rock!

Thank you so much for the info and it also confirms with what I
thought I already knew:)

On Apr 28, 2:08 pm, Josh <[email protected]> wrote:
> DaTurk,
>
> My assumption was that events were, in fact, multicast delegates, and
> after a little searching, it looks to be confirmed.
>
> http://www.netsplore.com/PublicPortal/blog.aspx?EntryID=9
>
> Additionally, I ran a quick little test.  A WinForm app with a single
> button and a single text box, wherein I added four methods that I then
> added to the button.Click event:
>
>          btn.Click += new EventHandler(btn_Click1);
>          btn.Click += new EventHandler(btn_Click2);
>          btn.Click += new EventHandler(btn_Click3);
>          btn.Click += new EventHandler(btn_Click4);
>
> In each of the four btn_Click methods, I add which event was fired and
> the Thread.CurrentThread.ManagedThreadId to the text box.  The only
> difference is that, in btn_Click1, I have a Thread.Sleep(1000).
>
> The few above comments seem to think that each delegate invocation of
> the event is fired in its own thread, but my above test disproves
> this: the methods are called synchronously, with btn_Click2 not being
> invoked until btn_Click1 is done sleeping and writing to the textbox.
>
> Some additional info from the MSDN multicast delegate definition 
> athttp://msdn.microsoft.com/en-us/library/system.multicastdelegate.aspx
> states the following:
>
> "A MulticastDelegate has a linked list of delegates, called an
> invocation list, consisting of one or more elements. When a multicast
> delegate is invoked, the delegates in the invocation list are called
> synchronously in the order in which they appear. If an error occurs
> during execution of the list then an exception is thrown."
>
> This statement coincides with the test I performed and my original
> assumption.
>
> Hope that helps a little.
>
> Josh
>
> On Apr 26, 5:37 am, DaTurk <[email protected]> wrote:
>
>
>
> > According to what theory?  Could you eleborate on my other questions?
>
> > On Apr 25, 1:43 am, ravindra kumar <[email protected]> wrote:
>
> > > according to theory you are right it should be fired
>
> > > On Sun, Apr 24, 2011 at 8:30 AM, analysis_junky 
> > > <[email protected]>wrote:
>
> > > > Not sure, but that should be easy enough to test. My hypothesis is
> > > > that thread B would fire even though thread A has called
> > > > Thread.Sleep(int).
>
> > > > On Apr 21, 12:44 pm, DaTurk <[email protected]> wrote:
> > > > > I was always under the impression a event was just a multicast delgate
> > > > > under the hood, is this correct?
>
> > > > > Another question I have is if I have several recipients of an event,
> > > > > do they get notified sequentually?
>
> > > > > And if they get fired sequentually, do they happen on the same thread?
>
> > > > > The reason I'm asking is if I have an Event with several recipients +=
> > > > > on it, and the first recipient gets notified but holds the thread, say
> > > > > with a sleep, or a lock, or for any reason ... will this block the
> > > > > rest of the recipients getting notified?
>
> > > > > Thanks in advance
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > > > Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML
> > > > Web Services,.NET Remoting" group.
> > > > To post to this group, send email to [email protected]
> > > > To unsubscribe from this group, send email to
> > > > [email protected]
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en
> > > > or visit the group website athttp://megasolutions.net
>
> > > --
> > > Ravindra kumar
> > > delhi- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

-- 
You received this message because you are subscribed to the Google
Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML
Web Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en
or visit the group website at http://megasolutions.net

Reply via email to