David Beckman
David Beckman

Reputation: 605

Visual Studio: Warn when private or internal members have no references

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...

Upvotes: 0

Views: 553

Answers (4)

TrueWill
TrueWill

Reputation: 25543

ReSharper does something similar with its Solution-Wide Inspections.

Upvotes: 0

Chris Fulstow
Chris Fulstow

Reputation: 41902

NDepend is perfect for this sort of thing.

Upvotes: 0

JaredPar
JaredPar

Reputation: 755179

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

Upvotes: 2

smercer
smercer

Reputation: 916

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

Upvotes: 0

Related Questions