I have several classes that implement the INotifyPropertyChanged interface.

I'm now using Resharper and want to add the following standard code snippet to these classes:

[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
    var handler = PropertyChanged;
    if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
}

The simplest solution I found so far is to delete the

public event PropertyChangedEventHandler PropertyChanged;

and implement the interface again, this time with the helper. Is there an easier way?

1

There are 1 answers

0
Onur On BEST ANSWER

If you press Alt+Return over the property, you get the chance to create the helper.

Screenshot N.b. the Mouse is over PropertyChanged.