Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to easyily find unused public methods/properties

I have a .Net(C#) solution. The solution contains bunch of projects. The projects were implemented not by me. It is not a framework, it means that I need to have amount of public methods/properties as less as possible. My task is to identify methods and properties which are not used, but exist in the projects. Well, I can find private methods which are not used using R#. But it is completely unclear how to find public methods/properties which are not used.

I heard that they have NDepend tool, but it is not very simple tool, is it.

So, the question is: could you please point to a tool which can be used to identify methods which are not used in a solution. It is OK with me to have command line tool or something pretty simple.

UPD: I tried to use trial NDepend.

Well, first of all it seems like it is possible to see public methods (properties are represented as get_ set_ methods) which are not used in this particular assembly.

But NDepend does not recognize if the public method is used from another project/assembly, which is a part of the solution and shows the method as unused. But this is not true.

UPD2: mcintyre321 advised to use R#. Please read a first comment below.

like image 406
Antipod Avatar asked Sep 24 '09 13:09

Antipod


1 Answers

If you turn on solution wide analysis in ReSharper (5.0 and above) it will flag them for you. This includes public methods.

  • Explanation of Solution-Wide analysis

  • How to enable

like image 141
mcintyre321 Avatar answered Nov 20 '22 13:11

mcintyre321