Back to Devexpress

Add Else Statement

coderushforroslyn-115687-coding-assistance-code-providers-add-else-statement.md

latest690 B
Original Source

Add Else Statement

  • Aug 03, 2020

Purpose

Adds the else block to the conditional.

Availability

Available when the cursor is on an if statement that does not have corresponding else block.

Usage

  1. Place the caret on an if block that has no else block.

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

  3. Select Add Else Statement from the menu.

After execution, the Code Provider adds the else block to the conditional.

csharp
if (a)
    return b;
else {

}
vb
If a Then 
    Return b
Else 

End If