Editing Resharper's INotifyPropertyChanged Editing Resharper's INotifyPropertyChanged wpf wpf

Editing Resharper's INotifyPropertyChanged


No, you can't edit the auto-generated code, because it needs to handle a number of possibilities when generating - e.g. C# 6 uses the ?. operator, and it also needs to handle when the event already exists and has already been initialised.

If you do want to use the shorthand version which doesn't have the local variable and the null check, then you can create the event first, and initialise it with = () => { }; before generating the OnPropertyChanged method. However, it is probably best to keep the local var + null check, for thread safety.