Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This refactoring applies to:
C#
Visual Basic
What: What: Split or merge if statements.
When: You want to split an if statement that uses the && or || operators into a nested if statement, or merge an if statement with an outer if statement.
Why: It's a matter of style preference.
How-to
If you want to split the if statement:
Place your cursor in the
ifstatement by the&&or||operator.Press Ctrl+. to trigger the Quick Actions and Refactorings menu.

Select Split into nested if statements.

If you want to merge the inner if statement with the outer if statement:
Place your cursor in the inner
ifkeyword.Press Ctrl+. to trigger the Quick Actions and Refactorings menu.

Select Merge with outer if statement.
