Back to Devexpress

Remove All Redundant Block Delimiters

coderushforroslyn-115560-code-style-assistance-code-formatters-remove-all-redundant-block-delimiters.md

latest1.2 KB
Original Source

Remove All Redundant Block Delimiters

  • Aug 03, 2020

Purpose

Used to remove redundant block delimiters throughout the method.

Availability

Available when the cursor is at the beginning of a method declaration.

Usage

  1. Place the caret at the beginning of a method declaration.

  2. Press the Ctrl + . or Ctrl + ~ shortcut to invoke the Code Actions menu.

  3. Select Remove All Redundant Block Delimiters from the menu.

After execution, the Code Formatter removes all redundant block delimiters in the method.

csharp
static void Main(string[] args) {
    Console.Write("Even numbers:");
    for (int i = 1; i <= 10; i++)
        if (i % 2 == 0)
            Console.Write($" {i}");
    Console.ReadKey();
}

See Also

Add/Remove Block Delimiters

Remove Unused Member

Remove Redundant Assignment

Remove Redundant Constructor