在MSDN上,我找到以下内容:
public event EventHandler<MyEventArgs> SampleEvent; public void DemoEvent(string val) { // Copy to a temporary variable to be thread-safe. EventHandler<MyEventArgs> temp = SampleEvent;
是参考吗?
如果是这样,我不明白它的含义,因为当SampleEvent变为null时,temp也是如此
if (temp != null) temp(this,new MyEventArgs(val)); }