5.3. Replace in Files

Although it's useful to search a large number of files and find a number of matches to your search criteria, even better is the Replace in Files action. Accessed via the keyboard shortcut Ctrl+Shift+H or the drop-down arrow next to Quick Replace, Replace in Files performs in much the same way as Find in Files, with all the same options.

The main difference is that you can enable an additional Results option when you're replacing files. When you're performing a mass replacement action like this, it can be handy to have a final confirmation before committing changes. To have this sanity check available to you, enable the "Keep modified files open after Replace All" checkbox (shown at the bottom of Figure 5-11).

Figure 5.11. Figure 5-11

Note that this feature works only when you're using "Replace All"; if you just click "Replace," Visual Studio will open the file containing the next match and leave the file open in the IDE anyway.

Important: If you leave this option unchecked and perform a mass replacement on a large number of files, they will be changed permanently without your having any recourse to an undo action. Be very sure that you know what you're doing.

Whether you have this option checked or not, after performing a "Replace All" action, Visual Studio will report back to you how many changes were made. If you don't want to see this dialog box, you have an option to hide the dialog with future searches.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.165.70