Pardon if this has been answered somewhere before.
I am not entirely sure how to phrase this question, so I'll do an example:
Lets say we have 2 different classes, A and B. If I have a static method in class A that I normally call by using "A.Method()" in my program, would it be possible to move this method from A to B so that it automatically refactors this new location "B.Method()" everywhere in the program?
In short, I would like to refactor the "location", rather than the method's "name", as I am moving methods from many different classes into one static method library.
Thank you for any pointers you can provide.
Not directly, but if you're sneaky, you can do it this way.
B
to C
. Do not auto-refactor. This will break compilation temporarily.A
to B
. This time, do allow the auto-refactor. This will change all instances of A.Method()
to calls to B.Method()
.C
back into B
. This will fix the compilation errors introduced in step 1.On the other hand, it might be simpler just to use a traditional search and replace (ctrl+F or shift+ctrl+F).