2

I've just done a major, major overhaul on a colleagues project and throughout the process almost everything got rewritten. There was far too much code beforehand.

Now, I am left with the prospect that in amongst my project somewhere are old pre-refactoring methods that are no longer needed.

Is there a way to search the whole project for such methods in one go?

I understand the risk of potentially removing code used via reflection.

It's very similar to this question, except I would like two extra things:

  • An answer specific to ReSharper
  • Instructions on how to achieve this using ReSharper as I cannot seem to figure it out
Community
  • 1
  • 1
joshcomley
  • 28,099
  • 24
  • 107
  • 147

2 Answers2

8

Use solution-wide analysis.

If you change "Unused declaration" in "R# Options/Inspection Severity/Code Redundancies/Unused declaration" to "Show as Errors", you'll be able to identify all unused declarations.

Pawel Lesnikowski
  • 6,264
  • 4
  • 38
  • 42
  • 4
    That's not entirely correct. This will show you unused declarations with private visibility, but not with internal or public. ReSharper 5 will likely have better story about this issue. – Ilya Ryzhenkov Oct 11 '09 at 21:40
  • This now works for public and internal members in the beta of R# 5. – Wilka Nov 10 '09 at 13:22
0

As far as I know, there is not way to do this with R# for the entire solution/project. The only way I know of is to go through your code manually, pressing Alt+F7 on each method name.

Levi Rosol
  • 4,398
  • 6
  • 28
  • 36