From time to time there is a need to improve existing code or adapt it to changes. When the standard refactorings do not help to achieve these goals, you can automate the changes using structural search and replace. Once you define patterns, then you use them to refactor your code in some projects or in the whole solution.
- On the main menu, choose ReSharper | Find | Search with Pattern. The Search with Pattern dialog box opens.
- Click Replace to switch to the Replace mode.
Define a search pattern in the Search pattern text area.
Define a replacement pattern in the Replace pattern text area.
- Click Replace to start searching for occurrences of your search pattern.
- The Replace with Pattern dialog box opens. Choose search pattern occurrences that you want to be replaced with the replace pattern, and click Replace.