Event Queues

  • Thread starter Thread starter Chuck B
  • Start date Start date
C

Chuck B

I couldn't find the info I was looking for anwhere else so I'll try here.

I have a custom control that calls a delegate method when a SelectHandler
event is fired. The SelectHandler method adds a ResetHandler method to the
control's ResetHandlers. My question is; will multiple instances of the
ResetHandler method be added to the event queue or is each method in the
queue unique?

If I knew how to get at the event handler queue I'd look for myself.
Unfortunately, I don't have a clue as to how pointers to delegates are
stored.
 
Chuck B said:
I couldn't find the info I was looking for anwhere else so I'll try here.

I have a custom control that calls a delegate method when a SelectHandler
event is fired. The SelectHandler method adds a ResetHandler method to the
control's ResetHandlers. My question is; will multiple instances of the
ResetHandler method be added to the event queue or is each method in the
queue unique?

It's not entirely clear to me what you mean. Could you post some code?
If I knew how to get at the event handler queue I'd look for myself.
Unfortunately, I don't have a clue as to how pointers to delegates are
stored.

http://pobox.com/~skeet/csharp/events.html may help a bit.
 
I have a custom control that calls a delegate method when a SelectHandler
event is fired. The SelectHandler method adds a ResetHandler method to
the
control's ResetHandlers. My question is; will multiple instances of the
ResetHandler method be added to the event queue or is each method in the
queue unique?

I recommend that you take a look at Jon's web page that he referred you
to. But in the meantime, I can tell you this: every time you add a
delegate reference to an event, a new copy of that reference is added to
the event. If you add the same delegate three times, then when you go to
execute the event handlers, the delegate will be called three times.

Whether this answers your question or not, I don't know. It's not easy to
figure out what exactly you're asking. But hopefully, that helps.

Pete
 
Back
Top