C# Events and Thread Safety

前端 未结 15 1122
甜味超标
甜味超标 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:08

    With C# 6 and above, code could be simplified using new ?. operator as in:

    TheEvent?.Invoke(this, EventArgs.Empty);

    Here is the MSDN documentation.

提交回复
热议问题