I noticed that quite a lot of code is using following code snippet to invoke event handler.
Public event EventHandler Handler;
Protected void OnEvent(){
var handler = this.Handler;
If(null!=handler){
handler(this, new EventArgs());
}
}
Why does it assign Handler
to a local variable before invoking other than invoking the event on Handler
directly. Is there any difference between those?