.NET EventHandlers - Generic or no?

后端 未结 9 1920
遇见更好的自我
遇见更好的自我 2020-12-03 13:53

Every time I start in deep in a C# project, I end up with lots of events that really just need to pass a single item. I stick with the EventHandler/Event

9条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-03 14:26

    I do believe that the recent versions of .NET have just such an event handler defined in them. That's a big thumbs up as far as I'm concerned.

    /EDIT

    Didn't get the distinction there originally. As long as you are passing back a class that inherits from EventArgs, which you are, I don't see a problem. I would be concerned if you weren't wrapping the resultfor maintainability reasons. I still say it looks good to me.

提交回复
热议问题