The Search with Pattern feature enables you to create code patterns, find their occurrences and replace them. This feature is much more powerful and flexible than common search tools. Moreover, you can set a severity level for a code pattern so that ReSharper highlights code matching the search pattern as a hint, suggestion, warning, or error, and provides quick-fixes.
So, using structural search and replace you can:
- define your own search patterns as complicated as necessary
- replace code smells or obsolete code constructs, a replacement pattern can be rather complicated as well
- store all patterns in the catalog and share them with team members
- see code fragments that match a search pattern highlighted in the editor
- use a replacement pattern as a quick-fix to fix problems right here right now
This feature is supported in the following languages/technologies:
The instructions and examples given here address the use of the feature in C#. For details specific to other languages, see the corresponding topics in the ReSharper by Language section.