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

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)
 
D

David

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.
 
P

Phil Jones

Wow - simple AND stupid. I like it! That it's undocumented is a little
scary.

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

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

Top