Revious
Revious

Reputation: 8156

Finding unused methods in .net environment

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

Upvotes: 0

Views: 63

Answers (2)

Revious
Revious

Reputation: 8156

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

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

Upvotes: 0

Markus
Markus

Reputation: 22501

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.

Upvotes: 1

Related Questions