Is there a shortcut that allows me to repoint all classes that use the old object and repoint them all to the new class that has the new object?
and i don’t mean just doing a Ctrl+F then replace.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If they’re all using a global variable, presumably they’re referring to it as
aren’t they? Can’t you just do a search and replace?
It’s possible that the refactoring tools will help you with this too, but I suspect in this case a search and replace is just as easy.
EDIT: I’ve just tried myself, and it’s certainly easy with Resharper: select the variable, right-click, Refactor, Move. Not sure about the native capabilities of VS2008 though.
Another option: change the design not to use a global variable in the first place. Dependency injection rocks 🙂