Tool for Visual Studio to automatically remove methods that aren't being referenced
I'm looking for a feature, script, or tool in Visual Studio to remove methods that aren't referenced by any code in a solution.
All my projects are in one solution (i.e. no external class libraries).
Usually I right-click on methods and choose "Find All References," and if the method declaration is the only reference, I de开发者_运维知识库lete he method, to help clean up the code.
For me this helps in the code analysis/reverse engineering process.
Try ReSharper: http://www.jetbrains.com/resharper/features/code_refactoring.html?gclid=CN66956kqagCFQoZ4Qodexn_HA
It's not free, but it is awesome :)
I think this is not the right thing to do, from the product perspective. If your class is being referenced by external applications, and if your public methods are being used in that external application, then by Find all References, you will not see those references in your solution.If you remove those methods, then the applications referencing your classes will be broken.(It may be the case that in your current situation this may not be the problem, but in general it would be). So i doubt if this will be a useful feature to have.
Use Resharper. Refreactor your code with ease. Its just awesome
精彩评论