ReSharper 4 introduced Code Cleanup - an extended feature set that superseded Reformat Code. For specific guidelines, see the following topics:
Running Code Cleanupin various scenarios (from the text editor, from Solution Explorer; in silent mode).
Default Profiles(Full Cleanup, Reformat Code).
Creating Custom Profiles(profile settings in detail).
Usage Scenarios(optimizing namespace import directives, reformatting code, removing code redundancies, etc).
Compared to Reformat Code, Code Cleanup provides two significant advantages:
- You can now not only reformat code but also remove code redundancies, reorder type members, migrate to C# 3.0, and perform a lot more tasks, all with one shortcut. That means, you can save a myriad of "go-to-next-highlight-then-apply-a-quick-fix" iterations by simply running Code Cleanup!
default profiles- Full Cleanup and Reformat Code - can be complemented by your custom task-specific profiles.
Code Cleanup unites a dozen of ReSharper features, including:
- Code formatting.
- Arranging 'this' qualifier.
- Removing code redundancies.
- Converting properties with backup fields to auto-properties.
- Marking fields as read-only if possible.
- Optimizing namespace import directives.
- Shortening qualified references.
- Inserting and updating file header.
- Replacing explicit types with vars.
- Reordering type members.
- Reformatting embedded XML doc comments.
Code Cleanup works in batch mode, so that you can instantly clean the whole project or even solution.
You can also choose
a profile for silent (dialogless) cleanup. See
In addition to the two default modes - Reformat Code and Full Cleanup, you can