When should you override OnEvent as opposed to subscribing to the event when inheritting

后端 未结 7 1987
梦谈多话
梦谈多话 2020-12-11 01:33

When should one do the following?

class Foo : Control
{
    protected override void OnClick(EventArgs e)
    {
        // new code here
    }
}
7条回答
  •  渐次进展
    2020-12-11 02:20

    If you override like Kent Boogaart comments you'll need to be carefull to call back base.OnClick to allow event suscriptions to be called

提交回复
热议问题