Visual Studio:当私有或内部成员没有引用时发出警告
有没有办法让 Visual Studio 警告私人成员在班级中没有任何引用?包/模块内没有引用的内部成员怎么样?
我一直在重构我的代码,我不想保留[右键单击] -->在我的代码库中查找每个成员的所有引用,以确保我已删除所有垃圾。必须有更好的方法...
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...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您是否尝试过打开 FxCop 性能规则?他们将检测具有内部或私人访问权限的未使用成员。
Have you tried turning on FxCop performance rules? They will detect unused members with internal or private access.
据我所知,Visual Studio 确实会对未使用的变量发出警告。这还不算覆盖吗?它们不是错误,只是警告。
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 非常适合此类事情。
NDepend is perfect for this sort of thing.
ReSharper 通过其解决方案范围检查执行类似的操作。
ReSharper does something similar with its Solution-Wide Inspections.