event Action<> vs event EventHandler<>

后端 未结 7 2256
野的像风
野的像风 2020-11-28 02:05

Is there any different between declaring event Action<> and event EventHandler<>.

Assuming it doesn\'t matter what object actua

7条回答
  •  误落风尘
    2020-11-28 02:39

    On the most part, I'd say follow the pattern. I have deviated from it, but very rarely, and for specific reasons. In the case in point, the biggest issue I'd have is that I'd probably still use an Action, allowing me to add extra properties later, and to use the occasional 2-way property (think Handled, or other feedback-events where the subscriber needs to to set a property on the event object). And once you've started down that line, you might as well use EventHandler for some T.

提交回复
热议问题