- 2 minutes to read
Used to simplify a boolean expression or bitwise operation if it is possible. The simplification involves removing unnecessary parentheses, toggling negations, parameter reordering, etc. without affecting the expression’s return value but making the entire expression easier to read.
Available in the following cases:
- When the caret is on an if statement whose condition can be simplified.
- When the caret is on an assignment or return statement which has a Boolean expression (bitwise operation) that can be simplified.
- When a Boolean expression (bitwise operation) that can be simplified is selected.
Place the caret on an if statement whose condition can be simplified.
The blinking cursor shows the caret’s position at which the Refactoring is available.
- Press the Ctrl + . or Ctrl + ~ shortcut to invoke the Code Actions menu.
- Select Simplify Expression from the menu.
After execution, the Refactoring replaces the condition with a simpler equivalent.
This Refactoring uses the Quine–McCluskey algorithm for simplification.