Back to Devexpress

Invert Selection

coderushforroslyn-120231-coding-assistance-code-providers-invert-selection.md

latest915 B
Original Source

Invert Selection

  • Aug 03, 2020

Purpose

Inverts the code elements. The supported inversions are listed below:

  • Boolean literal ( truefalse )
  • Equality operator ( ==!= )
  • Addition/substraction assignment ( a += ba -= b )
  • Assignment ( a = bb = a )
  • For -loop direction [for (int i = 0; i <= a.Length; i++)for (int i = a.Length; i > 0; i–)]

Availability

Available when the selection includes one or more supported code elements.

Usage

  1. Select one or more supported code elements.
  2. Press the Ctrl + . or Ctrl + ~ shortcut to invoke the Code Actions menu.
  3. Select Invert Selection from the menu.

After execution, the Code Provider inverts all supported code elements in the selection as shown in the Purpose section.