ReSharper Web Help

ReSharper 4 introduced Code Cleanup - an extended feature set that superseded Reformat Code. For specific guidelines, see the following topics:

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!
  • Two 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.

See Creating Custom Profiles for the complete list of cleanup settings.

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 Running Code Cleanup for details on available ways of running Code Cleanup.

In addition to the two default modes - Reformat Code and Full Cleanup, you can create custom cleanup profiles to fit your individual needs.

See Also