View Unused C# Classes

How can I run an inspection on my solution and list all unused classes?

I've created a new test class called DeleteMe.cs that is not referenced anywhere, but I'm not seeing anything show me that it's unused. 

0
1 comment

Hello Shaun M Bridges, thank you for your message.

The class names in this case should be greyed out (https://i.imgur.com/qpr4a9p.png).

If you would like all such cases to be presented in the list, then:

  • run Solution-Wide Analysis via "ReSharper | Options | Code Inspection | Settings | Enable solution-wide analysis";
  • run "Find Code Issues" on a solution/project/file (right mouse button click on a solution node in Solution Explorer). It will open a new tool window after the process is complete;
  • click "Filter Issues...";
  • click "Uncheck All";
  • enable "Type member is never used";
  • filter the result by the word "class".

An alternative option is to go to any unused class, hit "Alt+Enter", select "Inspection: 'Type member is never used'" | Find similar issues in file | Find in "..." solution | filter the result by the word "class". Please let me know if you have any questions. Thank you!

 

1

Please sign in to leave a comment.