delegates and events

  • Thread starter Thread starter Chris
  • Start date Start date
C

Chris

Hi,

is it possible to know what event-handlers are 'connected' to an event ?

(In the same style as you have access to the InvocationList with delegates.)

Thnx
Chris
 
Chris,
Seeing as an event is implemented in terms of a Delegate, yes you use
InvocationList to get the list of event-handlers.

The trick is getting the delegate for the event. Using a tool such as
ILDASM, you can see that the delegate is the name of the event with Event on
the end.

Public Class Chris

Public Event Changed As EventHandler

Public Sub GetHandlers
Dim list() As System.Delegate
list = me.ChangedEvent.GetInvocationList()
End Sub

End Class

Hope this helps
Jay
 

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

Back
Top