In C# you could intercept what gets subscribed as follows:
// In a Control derived class, for example: // Use override if the base class property was marked as virtual
public new event EventHandler Click
{
add
{
// Do not let derived classes subscribe to this event, they should instead override OnClick.
if (value.Target != this) base.Click += value;
}
remove { base.Click -= value; }
}
Share with