Reputation: 1479
If I ask ReSharper to implement INotyfyPropertyChanged
interface for me it creates below code
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
}
Is it possible (and if yes then where should I look for it) to restyle this snippet and to make ReSharper generate the changed one e.g. replace PropertyChangedEventHandler
with var
keyword and move condition body to the next line?
Upvotes: 2
Views: 97
Reputation: 54811
Both those options are in "code clean up" options:
Go to Resharper->Options...
Then go to Code Editing->Code Cleanup
This has set up the silent clean-up, but to explicitly clean up at anytime, there is a key shourtcut which is usually Ctrl+E, F
If this doesn't resolve the new line after the if
, then look under Code Editing->C#->Formatting Style. This is where the rules of "Reformat code" are defined.
Upvotes: 4