Tutorial :In VS 2008, how to do re-assign all classes that use a global variable to another class with the new variable?


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.


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 :)

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »