How wrong is it to create an event handler delegate with out the standard (Obj sender, EventArgs args) signature?

前端 未结 3 488
野趣味
野趣味 2021-02-05 19:18

I understand the benefits of using the standard MS event handler delegate signature as it allows you to easily expand on the information passed through the event with out breaki

3条回答
  •  粉色の甜心
    2021-02-05 20:04

    Use the EventHandler generic delegates for your events and create a type derived from EventArgs to hold your event data. So in other words, always. It's something that you always know exactly how it works when you come across it because it's never done otherwise.

    Edit:

    Code analysis CA1003: Use generic event handler instances
    Code analysis CA1009: Declare event handlers correctly

提交回复
热议问题