Friday, August 27, 2010

Visual Studio Tip of the day - Refactoring - Changing variable names

Did you mistype a variable/function/property only to realize it in the code review and are frustrated over the time you will need to spend to correct it across the whole source code?

Visual Studio 2005 has a new feature called refactoring by which you can rename a property/function/variable at one location and the same will be replicated across all the location where the property/function/variable is referenced.

To do that, select the property/variable/function you desire to rename and right click and select Refactor > Rename. A Rename window will appear and you can select whether you want to preview the reference changes, or you want to change the entity in the comments also.

Keyboard shortcut: Ctrl R + Ctrl R

No comments: