The Quick Actions lets you easily refactor, generate, or otherwise modify code with a single action.
The icon that appears when a Quick Action is available gives an indication of the type of fix or refactoring that's available.
Let's consider the following code where accidentally int
is written as itn
.
When you hover the mouse at the location of an error and if a fix is available, light bulbs appear.
To see potential fixes, select either the down arrow next to the light bulb or the Show potential fixes link. A list of available Quick Actions is displayed.
Now let's select the right action, like Change the itn
to int
and you will see that it automatically fixes the issue.
The Quick Action also enables you to remove variables that have been declared but never used in your code.
For more information about the quick actions in Visual Studio, visit the official documentation page https://docs.microsoft.com/en-us/visualstudio/ide/common-quick-actions