Pregunta

Is it possible to find all the unused method in a solution?

I.e.

Private method not called inside the class or method which are called from methods which are not called

¿Fue útil?

Solución

You can use static code analysis for this task if you have access to a Visual Studio Pro (or above). The relevant rule is CA1811. Please note that this method gives you a good starting point but might report false positives, so you should be cautious when you remove methods.

See this link for an overview of static code analysis.

Otros consejos

It's also possible to use NDepend following this article:

http://www.ndepend.com/DefaultRules/webframe.html?Q_Potentially_dead_Methods.html

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top