Raising C# events with an extension method - is it bad?

后端 未结 6 1262
执念已碎
执念已碎 2020-12-02 10:55

We\'re all familiar with the horror that is C# event declaration. To ensure thread-safety, the standard is to write something like this:

public event EventH         


        
6条回答
  •  南笙
    南笙 (楼主)
    2020-12-02 11:29

    [Here's a thought]

    Just write the code once in the recommended way and be done with it. Then you won't confuse your colleagues looking over the code thinking you did something wrong?

    [I read more posts trying to find ways around writing an event handler than I ever spend writing an event handler.]

提交回复
热议问题