When I implement an event in Visual Studio, Resharper is kind enough to suggest that I create an event invocator. I used to do this manually in the past, and my invocators always looked like this:
private void InvokePropertyChanged(PropertyChangedEventArgs e) { if (PropertyChanged != null) { PropertyChanged(this, e); } }
but the creator created by Resharper looks like this (cleared a little manually)
private void InvokePropertyChanged(PropertyChangedEventArgs e) { PropertyChangedEventHandler changed = PropertyChanged; if (changed != null) { changed(this, e); } }
Do people in reactive brains know something about C #, am I not doing this? Is there any technical advantage to having a local variable, or is it just an artifact due to which they should automatically generate code?
c # events
Michac
source share