Re: Is it possbile to enumerate Methods by Event?
- From: "athos.jingle@xxxxxxxxx" <athos.jingle@xxxxxxxxx>
- Date: Fri, 23 Nov 2007 12:36:08 -0800 (PST)
On Nov 23, 8:15 pm, Jon Skeet [C# MVP] <sk...@xxxxxxxxx> 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".
--
Jon Skeet - <sk...@xxxxxxxxx>http://www.pobox.com/~skeet Blog:http://www.msmvps.com/jon.skeet
World class .NET training in the UK:http://iterativetraining.co.uk
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":
[DebuggerHidden, DebuggerStepThrough]
public void AddEventHandler(object target, Delegate handler)
{
MethodInfo addMethod = this.GetAddMethod();
if (addMethod == null)
{
throw new
InvalidOperationException(Environment.GetResourceString("InvalidOperation_NoPublicAddMethod"));
}
addMethod.Invoke(target, new object[] { handler });
}
public MethodInfo GetAddMethod()
{
return this.GetAddMethod(false);
}
public abstract MethodInfo GetAddMethod(bool nonPublic);
.
- Follow-Ups:
- Re: Is it possbile to enumerate Methods by Event?
- From: Jon Skeet [C# MVP]
- Re: Is it possbile to enumerate Methods by Event?
- References:
- Is it possbile to enumerate Methods by Event?
- From: athos.jingle@xxxxxxxxx
- Re: Is it possbile to enumerate Methods by Event?
- From: Jon Skeet [C# MVP]
- Is it possbile to enumerate Methods by Event?
- Prev by Date: Re: Generics Question
- Next by Date: Re: Is it possbile to enumerate Methods by Event?
- Previous by thread: Re: Is it possbile to enumerate Methods by Event?
- Next by thread: Re: Is it possbile to enumerate Methods by Event?
- Index(es):
Loading