1

I have a project , there is several classes. I want to search used and not used properties in project.

is visual studio have any way to search ueed properties. Programing language is C#.net

kumara
  • 9
  • 1
  • Comment them out, and compile. Rinse repeat as needed. – leppie Dec 10 '10 at 09:29
  • possible duplicate of [Open source Tool to find unreachable/unused c# code](http://stackoverflow.com/questions/1706114/open-source-tool-to-find-unreachable-unused-c-code) – Bobby Dec 10 '10 at 09:29
  • Try ReSharper http://www.jetbrains.com/resharper/features/code_analysis.html – Ralf de Kleine Dec 10 '10 at 09:29
  • Further Duplicates: http://stackoverflow.com/questions/245963/find-unused-code http://stackoverflow.com/questions/1706114/open-source-tool-to-find-unreachable-unused-c-code http://stackoverflow.com/questions/1708883/tool-to-find-all-unused-code http://stackoverflow.com/questions/579617/best-practices-for-removing-unused-code – Bobby Dec 10 '10 at 09:29
  • @Bobby: LOL how can you find so many duplicates quickly – Cheng Chen Dec 10 '10 at 09:31
  • 1
    @Danny Chen: That's my little dirty secret...but to be honest, entering "c# unused code" into the search field in the right top-corner yields many results. – Bobby Dec 10 '10 at 09:33

5 Answers5

5

ReSharper

Cheng Chen
  • 42,509
  • 16
  • 113
  • 174
2

I suppose you have to use some third party tools available in the market.Just Google it and you will find many.I recommend resharper which gives you many added functionality

biju
  • 17,554
  • 10
  • 59
  • 95
1

Find all references.

Piotr Justyna
  • 4,888
  • 3
  • 25
  • 40
1

Just use the "Run Code Analysis" option. It will show the unused calls (if they are not public and available to everyone.

Ignacio Soler Garcia
  • 21,122
  • 31
  • 128
  • 207
0

Even if code analysis tools might help in searching this properties, you can't rely on code analysis tools completely, because a client code might access a property with reflection.

This includes data contracts your client proxies might have in case of WCF, javasript json serialization dependencies and the like.

You can try comment out properties suspected to have no usages, but you have not only to make sure it compiles, but also have all the the tests to pass.

Hope you have a decent test coverage and intergated test suites in place.

George Polevoy
  • 7,450
  • 3
  • 36
  • 61