Reputation: 1885
Ideally, our projects contain no unused namespaces / methods / functions and classes.
It is fairly simple to find the number of usages of all of these, for instance;
Has two usages while the following class is never used:
Such code can remain unnoticed for quite some time, while providing unwanted overhead to the total solution. What I'd like to achieve is an overview of all unused code, so developers can easily assess what should and shouldn't stay in the solution.
Of course we're not going to manually search for these... How can we find all unused code?
Upvotes: 18
Views: 15230
Reputation: 10148
To find unused code in Rider:
Alternatively, as you read or edit your code in the editor, you may encounter specific unused code warnings that Rider shows you. If you want to find all issues similar to one specific issue:
Upvotes: 35