Any piece of code that is highlighted as error, warning, suggestion, or hint as a result of code analysis can be instantly repaired using quick-fixes.
Quick-fixes are represented by a red or yellow light bulb icon that appears automatically to the left of a highlighted code line, when you position the caret on the highlight.
NoteSome quick-fixes act as shortcuts to ReSharper
You can display the list of available quick-fixes for a given highlight, either by clicking the light bulb or by pressing Alt+Enter. Then simply select an appropriate quick-fix from the list, and it will correct your code automatically.
- Click a highlight (error, warning, suggestion, or hint) in the source code, or the corresponding marker in the Marker Bar to show the light bulb.
- Click the red or yellow bulb, or press Alt+Enter.
- Select the desired quick-fix in the drop-down list of available actions, or select the action using arrow keys and press Enter.
- In some cases a quick-fix is applied and the code is updated immediately. If a quick-fix involves direct editing of source
code (for example, Change All), the editor turns into special mode, which is indicated by a blue highlight in red frame, and a suggestion list is displayed:
- Select the desired option from the suggestion list and press Enter (to discard changes, press Esc). So doing, ReSharper detects all occurrences of the symbol that are highlighted as errors, and replaces them automatically.
For guidelines on how to change inspection severity for issues that specific quick-fixes are designed to fix, see