In addition to traditional
- They only work when you
let ReSharper analyze your whole solution.
- Most of them help detect unused non-private members on-the-fly (see list below for details).
- They are only displayed in code and on the
Marker Bar, not in the Errors in Solution tool window.
NoteSimilar to any other inspection, you can
change severity levelof a solution-wide inspection in the ReSharper | Options | Code Inspection | Inspection Severity tab. However, changing severity of a solution-wide inspection to error doesn't necessarily mean that such inspection will appear in the Errors in Solution tool window.
As usual, for any such warning or suggestion, ReSharper provides one or several
Specifically, solution-wide warnings and suggestions help you discover:
- 1. Unused non-private type or member declarations:
- 2. Unused return values of non-private methods.
- 3. Unused parameters in non-private members.
- 4. Unassigned fields.
- 5. Unaccessed non-private fields.
- 6. Members and types that can be made internal, private or protected instead of public:
- 7. Non-private classes that can be made sealed.
- 8. Non-private classes or members that can be made static.
- 9. Non-private local variables or fields that can be converted to constants.
- 10. Non-private fields that can be made read-only:
- 11. Non-private classes with never overridden virtual members.
- 12. Non-private events that are never subscribed to.
- 13. Abstract or virtual events that are never invoked:
- 14. Auto-implemented non-private property accessors that are never used.
- 15. Suspicious type conversions or checks.
- 16. Non-private type members that are never used via base type or interface
- 17. Non-private type members that are only accessed from overrides
- 18. Parameters of non-private methods that can be declared with IEnumerable<T> type
- 19. Non-private methods that can have IEnumerable<T> return type
- 20. Redundant method overloads
- 21. Non-static classes that are never instantiated
NoteIn ReSharper 4.1 and earlier, most of these inspections had been available, but for private usages only. ReSharper 4.5 introduced solution-wide inspections to extend code analysis coverage to the whole solution. If solution-wide analysis is turned off, corresponding inspections for private usages are executed anyway.
In addition, two
MeansImplicitUseAttribute, are available to mark certain non-private types and members if they are left unused intentionally, which prevents ReSharper
from warning about them.