Reputation: 25287
I would like to be able to enumerate all events, which a class implements.
class A
{
public delegate void X();
public event X EventA;
}
class B:A
{
public event X EventB;
}
What should I do to typeof(B)
to get a list, which would consist of EventB
?
Upvotes: 2
Views: 208
Reputation: 39013
Well, there's the Type.GetEvents
method, you should use it. If you only want events declared at B, and not inherited from A, pass DeclaredOnly
as one of the binding flags.
Upvotes: 6