开发者

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

开发者 https://www.devze.com 2022-12-11 22:57 出处:网络
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?

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 ha开发者_运维技巧ve 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...


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


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


NDepend is perfect for this sort of thing.


ReSharper does something similar with its Solution-Wide Inspections.

0

精彩评论

暂无评论...
验证码 换一张
取 消