Amit,
| but FooEvent is never declared. Perhaps the author meant to say Foo, which
| is declared as an event but in that case I will not be able to call
| GetInvocationList method because it is not static.
Ah! There's the rub!
FooEvent is declared by the compiler, when the compiler sees the Event Foo
declaration.
In other words, its an implementation detail of how the Event keyword is
implemented.
You can use ILDASM to see the defination of FooEvent.
Try it & see, the code will work as demonstrated.
Hope this helps
Jay
|
| | > > That is fine, but is there a way to find out if there are event
| handlers?
| >
| >
|
<URL:
http://dotnet.mvps.org/dotnet/code/codingtechnique/#EventHandlerCount>
| >
|
| I don't think this sample code is syntactically correct. It has this
| snippet:
| If FooEvent Is Nothing Then
| Return 0
| Else
| Return FooEvent.GetInvocationList().Length
| End If
|
| but FooEvent is never declared. Perhaps the author meant to say Foo, which
| is declared as an event but in that case I will not be able to call
| GetInvocationList method because it is not static.
| Thanks
| Amit
|
|