Monday, October 28, 2013

Refactoring in Visual Studio, Part 1

Rename

Did you know that there's an easier way to rename properties, methods, variables, etc? This lovely little gem works across all files in the current solution too, so it does more than just a single method or file at a time. Right-click on the item you want to rename and select "Refactor-->Rename".


Type in the new name and hit the OK button.
  


Review the preview if necessary, and click the Apply button when you're ready to process the rename.


 Your code now reflects the changes.



1 comment:

  1. Awesome! Another way to do this is to change the name of the variable at its declaration and before moving your cursor anywhere else, hit CTRL+. for a context menu. You will then be able to up/down arrow your way to a "Rename" option that will rename all used references to that variable.

    ReplyDelete