Re: Event Invocation List

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I was hoping to get the invocation list of an existing instance, after
the existing idiom:

swfObjectInstance.SomeEvent += new EventHandler(MyMethod);

then elsewhere:

Delegate[] invocationList =
swfObjectInstance.SomeEvent.GetInvocationList();

But this raises an error of CS0079.

Well.. I did a bit more research and it doesn't seem possible unless I:

1) Do what you've shown here, by creating my own EventHandler and
passing that on to the object
2) Deriving the class and handling it internally

If anyone has any alternatives, I'll be glad to hear them.

-Rob

.



Relevant Pages

  • Re: Delegates are useful, and here is why (sample program)
    ... we see delegate examples that are related to event ... handling or they are for delegate's sake, giving us a false impression ... that delegates are for event handling only. ... method signature, we give the concrete task to the ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Delegates are useful, and here is why (sample program)
    ... we see delegate examples that are related to event ... handling or they are for delegate's sake, giving us a false impression ... that delegates are for event handling only. ... method signature, we give the concrete task to the ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Event Invocation List
    ... robinhoode wrote: ... the existing idiom: ... unless the owner chooses to expose the delegate to you ... For field-like events you *could* use reflection to get the delegate, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: adding leading zeros to a filename
    ... > How do you handle the case where directory contains no *.jpg. ... Is there an idiom for the test? ... handling for the error case you may catch the test before you enter the ... Janis ...
    (comp.unix.shell)
  • Events
    ... I'm aware of two different ways of raising events from a class, using an EventHandler and deriving a class from this in order to pass information - and using a delegate. ...
    (microsoft.public.dotnet.languages.csharp)