Code Cleanup unites a dozen of ReSharper features, including but not limited to:
- 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. That means, you can save a myriad of "go-to-next-highlight-then-apply-a-quick-fix" iterations by simply running Code Cleanup.
There are two
default profiles of Code Cleanup:
Reformat Code and
You cannot change these profiles, however, to adjust code cleanup to your custom requirements, you can create custom cleanup profiles to fit your individual needs. You can also choose a default or custom profile to be used for silent cleanup.
For specific guidelines, see the following topics:
- Running Code Cleanup in various scenarios (from the text editor, from the 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).
Code Cleanup settings, including custom profiles, can be shared with fellow developers to ensure uniform look and feel of your code (see Managing and Sharing Options for details).
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.
- Running Code Cleanup
- Default Profiles
- Creating Custom Profiles
- Usage Scenarios
- Complete Statement
- Importing Namespaces
- Managing and Sharing Options
- Auto-Inserting Parentheses and Quotes
- ReSharper Options | Code Editing | Code Cleanup
- ReSharper Options | Code Editing | File Header Text
- ReSharper Options | Code Editing | C# | Formatting Style
- ReSharper Options | Code Editing | Visual Basic .NET | Formatting Style
- ReSharper Options | Code Editing | HTML | Formatting Style
- ReSharper Options | Code Editing | CSS | Formatting Style
- ReSharper Options | Code Editing | XML | Formatting Style