Search all methods without reference Visual Studio

Asked

Viewed 259 times

2

How to search all methods without reference in Visual Studio, ie methods that are not being used, know that by clicking on a method with the right button and and choosing "Find All References" it shows the references, how to do for all of the Solution?

  • By "no reference" you mean "unused"?

  • Very useful for working with legacy systems.

1 answer

3


In standard Visual Studio there is no way, but there are utilities to install in it that can help.

In the Fxcop there are some rules that detect this, especially the

Private methods that are not called from any other code (CA1811)

It doesn’t solve everything, but it makes it obvious. If you have something public that hasn’t been used, you need to think about why it hasn’t been used, maybe it could be one day. I would not go out liming these methods so easily, let alone use them just to have use.

The Resharper can make a search in the whole solution. In the solution look for Find Code Issues And then Unused Symbols. Search not only unused methods.

You can also go on ReSharper => Inspect => Codes Issues Then goes on Filter Issues and there select Redundancy in Symbol Ddeclaration => type or type member is never use.

There is still the Ndepend. You have to create a query, you have to example on the website.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.