Skip to main content

Remove Region Directives

In This Article

Removes related #region and #endregion directives, and moves the cursor to the beginning of the enclosed code block that was enclosed by those directives.

#Availability

From the context menus or via shortcuts:

  • when the edit cursor or caret is on the #region or #endregion directive.

#Example

#region MyRegion
private void MyMethod()
{
    int a = TestMethod();
    int b = TestMethod();
}
#endregion
#Region "MyRegion"
Private Sub MyMethod()
    Dim a As Integer = TestMethod()
    Dim b As Integer = TestMethod()
End Sub
#End Region

Result:

private void MyMethod()
{
    int a = TestMethod();
    int b = TestMethod();
}
Private Sub MyMethod()
    Dim a As Integer = TestMethod()
    Dim b As Integer = TestMethod()
End Sub