Introduce Setter Guard Clause
Purpose
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.
Availability
Available when the caret is on a set keyword.
Usage
Place the caret on a set keyword.
Note
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.