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

有帮助吗?

解决方案

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.

其他提示

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

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top