![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
To attach a method to an event, we can use EventInfo.AddEventHandler. After attached, given an event's name, is it possible to retrieve all methods attached to it? |
#3
| |||
| |||
|
|
No. An event is really just a pair of methods, add and remove. Although *usually* there's a delegate variable backing it, the add/remove can do anything they want, and there's no part of an event which is a "fetch". -- Jon Skeet - <sk... (AT) pobox (DOT) com>http://www.pobox.com/~skeet Blog:http://www.msmvps.com/jon.skeet World class .NET training in the UK:http://iterativetraining.co.uk |
#4
| |||
| |||
|
|
On Nov 23, 8:15 pm, Jon Skeet [C# MVP] <sk... (AT) pobox (DOT) com> wrote: No. An event is really just a pair of methods, add and remove. Although *usually* there's a delegate variable backing it, the add/remove can do anything they want, and there's no part of an event which is a "fetch". OK I'm just curious... Yeah I could not find a way to track, but, it should be somewhere in the memory, right? |
|
Existing as a linked list, or inside an internal Class... Unfortunately I don't know CIL (MSIL), and reflector stops at the mysterious abstract Method "abstract MethodInfo GetAddMethod": |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |