Find Unused public functions

心已入冬 提交于 2019-12-03 18:46:20

问题


Is there a way to automatically find all unused public functions in a solution? I have resharper, and right now I have to do a "find usages" on each symbol, which is tedious--it seems like there should be a better way


回答1:


Of course there's a better way. Here's what you should do if you use ReSharper 4.5 or later:

  1. Go to ReSharper > Options > Code Inspection > Inspection Severity.
  2. Scroll down to "Unused symbols" category and set all containing items called "Non-private accessibility" to be shown - whether they're shown as hints, warnings, or suggestions is not relevant and is entirely up to you.
  3. In ReSharper > Options > Code Inspection > Settings, check "Analyze errors in whole solution". Press OK to apply changes in ReSharper Options.
  4. Right-click the solution node in Solution Explorer, and select "Find code issues". ReSharper will display various code issues that it detects in your solution in "Inspection results" tool window. Specifically, under "Unused symbols", you'll see all non-private types and members in your code that are not used.


来源:https://stackoverflow.com/questions/5846821/find-unused-public-functions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!