GetInvocationList - Where's the multi-cast delgate again?

  • Thread starter Thread starter Phil Jones
  • Start date Start date
P

Phil Jones

I think I might be missing something simple/stupid - but I'm trying to get
the delegates that are listed as event handlers for an event from within an
object instance. For example:


Namespace Foo
Public Delegate Sub MyEventHandler(ByVal sender As Object, _
ByVal e As EventArgs)

Public Class MyObject
Public Event MyEvent As MyEventHandler

Public Sub EnumerateEventDelegates()
' ??? What do I call "GetInvocationList" on?
End Sub
End Class
End Namespace



How do I get hold of the multi-cast delegate for the "MyEvent"?
I've had this explained to me in C# terms - but C# defines a field and a
property, and the field is the multi-cast delegate I'm looking for. This
isn't so with VB so I'm a little stuck.

Cheers everyone!

===
Phil
(Auckland | Aotearoa)
 
I think I might be missing something simple/stupid -

You know, that phrase could have two meanings...

but I'm trying to get
the delegates that are listed as event handlers for an event from within an
object instance.
Public Event MyEvent As MyEventHandler
How do I get hold of the multi-cast delegate for the "MyEvent"?
I've had this explained to me in C# terms - but C# defines a field and a
property, and the field is the multi-cast delegate I'm looking for. This
isn't so with VB so I'm a little stuck.

Dim d() As System.Delegate = MyEventEvent.GetInvocationList()

Unfortunately, AFAIK the only solution really is this stupid, and worse
I'm pretty sure it's undocumented as well. Welcome to VB.Net.
 
Wow - simple AND stupid. I like it! That it's undocumented is a little
scary.

Thanks for your help David.
===
Phil
(Auckland | Aotearoa)
 
Back
Top