Resharper 5's new pattern matching seems very powerful, though it takes a bit of tinkering to work out how to use it.
For those who aren't familiar with this feature, it allows you to search for specific patterns within your code. Instances of such patterns may optionally be replaced with an alternative. In IntelliJ this was called structural search and replace. It's much more powerful than simple RegEx search/replace.
I'd like to collect a series of patterns that people are using so that I can learn how to use this feature better.
I propose that each answer include:
- a brief introduction of the rationale for the pattern
- an example of what it would match
- an optional example of a replacement
- the XML generated by exporting the pattern so that others can try it out too