Quick-delete surrounding statements in Visual Studio or Resharper

Cel asked on stack overflow the following question. Unfortunately, I was not able to paste in a GIF of the solution. Hence I am using a blog post in lieu

The Question:

I often find I need to remove nesting statements, say an if conditional becomes irrelevant:

From

    if (processFile != null && processFile.Exists)
    {
        Process[] processesByName = GetProcesses(processFile.NameWithoutExt);
        if (processesByName.Length > 0)
        {
            return processesByName.ToList();
        }
    }

    return null;

To

    Process[] processesByName = GetProcesses(processFile.NameWithoutExt);
    if (processesByName.Length > 0)
    {
        return processesByName.ToList();
    }

    return null;

The trouble is having to manually find the curly braces on both sides and delete them, while retaining the nested code

  • Especially with larger bodies, unlike the example here
  • Any way to quick-erase with Resharper?
  • Or in Visual Studio natively?

The Answer

I use a series of short cuts

CTRL + SHIFT + ]

This selects the surrounding curly braces.

CTRL + ALT + ➔

This expands the selection

Then I simply cut and paste and delete the using statement, or the if statement.

CTRL + . to finally clear the redundant curly bracket.

Watch the demo i recorded here:

_config.yml

Written on September 21, 2026