Context actions are shortcuts to different ReSharper features that are displayed right in the code editor when you work with C#, VB.NET, XML, or ASP.NET code.
Whereas quick-fixes are intended to fix errors and less serious code issues, context actions just give an overview of ReSharper features that can be applied at a certain code position. Whether you use the suggested context actions or not is entirely up to you.
Availability of context actions for a code position is designated by one of the following icons to the left of the current line:
- for code editing actions
- for refactoring actions
- for navigation actions
Context actions can also be available in the same drop-down lists as quick-fixes. If that's the case, a quick-fix icon is displayed to the left of the code line.
For example, context actions for C# can help you:
- Change member visibility from public to private or protected.
- Apply a contextually available refactoring.
- Convert an anonymous method to a lambda expression, or vice versa.
- Convert an implicit interface implementation to an explicit interface implementation, or vice versa.
- Create a derived type.
- Create a method overload without a parameter.
- Initialize an auto-property from a constructor parameter.
- Replace an ArrayList with a generic List<T>.
To examine the full list of context actions available for a particular language, see:
- List of Context Actions for C#
- List of Context Actions for VB.NET
- List of Context Actions for XML
- List of Context Actions for ASP.NET
- Click an icon to the left of the current code line that shows availability of context actions. This could be either one of context action-specific icons listed above or a quick-fix icon.
Press Alt+Enter. A drop-down list that includes
all available context actions and quick-fixes is displayed. In this case, the drop-down list
one particular context action.
For guidelines on how to customize lists of context actions that you would like ReSharper to suggest, see Configuring Context Actions.
To learn how to view drop-down lists of available context actions and apply them, see Applying Context Actions.