views:

54

answers:

5

Hi everyone, I would like to explain my needs by a sample context below. I have a C# class ClassC which does task TaskT. I've just updated ClassC to fullfill TaskT in a second approach but still keep the first/old one intact.

Now I finished coding and want to remove all of the old codes related to the first approach. How can I do this in Visual Studio 2010?

A: 

Try Resharper. http://www.jetbrains.com/resharper/

Jon
A: 

Can't you simply use the "Find all references" feature ?

thelost
@thelost: Did you mean I need to visit every single class members to do a right click and then "find all references"? If so, I'd rather not do it. I want to have the list quickly.Thanks anyway.
Nam Gi VU
no, go to the old implementation and ask for the references. You could also comment the old implementation and you will need to fix the references in order to compile. Or am I getting it wrong ?
thelost
@thelost: You are lost ^_^ What I mean is the codes are there and unused. How can you comment the unused methods/properties? I guess we can't.
Nam Gi VU
Then I got it wrong, sorry. However, you can comment them but this won't help. So you should guess you can comment them.
thelost
+1  A: 

Resharper, available as plugin for Visual Studio, does this sort of static code analysis, and more. Be careful, though, it is easy to trip yourself up with this sort of thing if you use reflection or other techniques that can fool static code analysis.

Ani
I agree, Resharper is awesome. Just don't follow it blindly. It will tell you that you can safely delete things or change their visibility, but you might be exposing them for others to call or they may be there for use later on.
Rich
A: 

This answer might help.

KMan
+2  A: 

you can try using the NDepend tool.

RRUZ