Invert Selection
Purpose
Inverts the code elements. The supported inversions are listed below:
- Boolean literal (true → false)
- Equality operator (== → !=)
- Addition/substraction assignment (a += b → a -= b)
- Assignment (a = b → b = 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
- Select one or more supported code elements.
- Press the Ctrl + . or Ctrl + ~ shortcut to invoke the Code Actions menu.
- 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.