Introduce Setter Guard Clause
Introduces a value changed check at the beginning of a property setter. This will prevent the property value from being overwritten by a similar one, which may speed up your code.
Available when the caret is on a set keyword.
Place the caret on a set keyword.
The blinking cursor shows the caret’s position at which the Code Provider is available.
- Press the Ctrl + . or Ctrl + ~ shortcut to invoke the Code Actions menu.
- Select Introduce Setter Guard Clause from the menu.
After execution, the Code Provider adds the guard clause to the beginning of the setter body.