Reputation: 2491
Is there a functionality in Visual Studio to allow me to see all the unused methods that are no longer being called within my solution?
Upvotes: 2
Views: 681
Reputation: 10152
In versions prior to and including Visual Studio 2013, Ultimate Version provided Code Lens, which would show the number of references for a particular method or class. Visual Studio 2015 will bring this feature to everyone, not just the privileged Ultimate owners. If you don't have Ultimate in your current version, what you can do is right click on a method and select Find All References
. Another neat option is to right click and select View Call Hierarchy
. It will show you calls to and from the method.
If you're open to the third party options, then ReSharper actually does a fantastic job of showing unused elements. https://www.jetbrains.com/resharper/
Upvotes: 2
Reputation: 14604
Select the method name and right click on that there will be an option Find All References
or just press Shift +F12
which will list all the places from where this method is being called. So if method is not being called from anywhere there will be only one reference where it is defined so you will know that whether this method is being used or not.
Upvotes: 0