views:

48

answers:

4

Is there a way to get visual studio to warn that a private member does not have any references within the class? How about internal members that have no references within the package / module?

I have been re-factoring my code and I don't want to keep [right-click] --> Find All References for each member in my code base to ensure I have removed all cruft. There has to be a better way...

A: 

As far as I know, Visual Studio does give warnings for unused variables. Doesn't that cover it? They are not errors, just warnings.

smercer
That warning is only on class variables, not methods or properties.
David Beckman
+2  A: 

Have you tried turning on FxCop performance rules? They will detect unused members with internal or private access.

JaredPar
Oooh - nice tool! Thanks for the tip!
David Beckman
A: 

NDepend is perfect for this sort of thing.

cxfx
A: 

ReSharper does something similar with its Solution-Wide Inspections.

TrueWill