Back to Devexpress

Compress/Expand Assignment

coderushforroslyn-115374-refactoring-assistance-compress-expand-assignment.md

latest1.0 KB
Original Source

Compress/Expand Assignment

  • Aug 03, 2020

Purpose

Converts an assignment to its short form or expands the short form assignment to a full assignment expression. Short form assignments are more compact and clearer than the full expressions.

Availability

Available when the caret is at the beginning of a compressible assignment expression or a short form assignment.

Usage

  1. Place the caret at the beginning of a compressible or expandable assignment expression.

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

  3. Select Compress Assignment from the menu ( Expand Assignment if you are expanding the short form assignment).

After execution, the Refactoring converts the assignment to its short form or vice versa.

csharp
a += b;
vb
a += b

See Also

Compress to/Expand Ternary Expression