Quick-delete surrounding statements in Visual Studio or Resharper
Change the condition to if (true || whatever)
? I think that ReSharper will then tell you that the condition is always true, and will offer to remove it.
One solution, although it might not be ideal:
- Click and drag to mark the code you want to keep.
- Use the Resharper command "Surround with..." and select "
#region
". - Now you can collapse the code you want to keep using the minus sign at the top of the new region.
- Remove the code surrounding the
#region
- Now click the
#region
title again and select the Resharper option "Remove region/endregion directives".
Not a perfect solution, but it should help you get a better overview of what you're doing when working with larger blocks of code than your OP example.
It should look something like this (where the #region
directive can hide any of lines of code):
Shift+delete
to cut IF
line
Alt+Enter
on bracket to remove redundant braces.