C# Events and Thread Safety

前端 未结 15 1321
甜味超标
甜味超标 2020-11-22 06:00

UPDATE

As of C# 6, the answer to this question is:

SomeEvent?.Invoke(this, e);

I frequently hear/read the fo

15条回答
  •  长发绾君心
    2020-11-22 06:29

    I've never really considered this to be much of an issue because I generally only protect against this sort of potential threading badness in static methods (etc) on my reusable components, and I don't make static events.

    Am I doing it wrong?

提交回复
热议问题