ReSharper Web Help

Most of quick-fixes can fix the current issue under the caret, but some of them (e.g. Remove unused directives, Make field read-only, Remove redundant cast, etc.) can also automatically find and fix issues in a larger scope - in the current file, in the current project or in the whole solution.

You can recognize such fix by a small arrow displayed next to it in the action list.

Scalable quick-fix

Tip

Small fixes in a specific scope can also be done with the Code Cleanup.

To apply fix in scope
  1. Set the caret to a code issue highlighted by a ReSharper's inspection.
  2. Press Alt+Enter or click on the action indicator, which appears to the left of the code issue, to open the action list.
  3. Choose a quick fix that you want to apply.
  4. Click on the arrow to right of the quick-fix or press the right arrow key to expand the list of available scopes. If there is no arrow to the right of a quick-fix, then this quick-fix only applies locally.
  5. Select the scope for the quick-fix to apply and click on it or press Enter.

Tip

All files where ReSharper applies fix in scope open in the editor tabs. If necessary, you can undo all that was changed in these files with a single command: choose Edit | Undo in the main menu or press Ctrl+Z.

The full list of quick-fixes that can be applied in wider scopes include:

  • C#
    • Use 'var'
    • Redundant array creation expression
    • Redundant 'else' keyword
    • Redundant control flow jump statement
    • Redundant comma in array initializer
    • Empty object or collection initializer list is redundant
    • Redundant argument name specification
    • Redundant lambda signature parentheses
    • Explicit integer type specifiers for enumerations
    • true specifiers in for statements
    • Redundant type casts
    • Redundant qualified references
    • Redundant this qualifiers
    • Redundant parentheses from attributes without arguments
    • Explicit calls to base class constructors without arguments
    • Redundant boolean comparisons
    • Redundant braces from collection initializers with a single expression
    • Redundant explicit delegate creation expressions
    • Empty argument lists from object/collection initializers
    • Redundant new keywords
    • Redundant partial modifiers on type declarations where a type has a single part
    • Redundant unsafe contexts and statements
    • Redundant object.ToString() calls (for example, in a concatenation with a string or as an argument of a string.Format() call)
    • Redundant string.ToCharArray() calls
    • Redundant specifications of type arguments
    • Signatures in anonymous methods where its parameters are not used in the method body
    • Non-referenced labels
    • Redundant field initializers
    • Redundant explicit names in anonymous type properties
    • Redundant nullable types where value type is implicitly convertible to nullable
    • Nullable types to short form ( Nullable<T> to T?)
    • Static method invocations to extension method calls where extension methods are invoked as static methods
    • Conversions to implicitly typed array creation expressions when array type can be inferred from initializer
    • Use auto-property if possible
    • Make field read-only, if possible
    • Optimize ???using??? directives
  • VB.NET
    • Optimize ???import??? directives
    • Shorten qualified references
    • Remove redundant qualifiers
  • JavaScript
    • Terminate statements
  • ASP.NET
    • Optimize register directives