JetBrains, maker of the popular IntelliJ IDEA IDE, entered the .NET tools market with its ReSharper product several years ago. An add-on to Microsoft's Visual Studio, ReSharper at first focused on bringing IntelliJ's sophisticated refactorings to the .NET environment. Since its initial release, ReSharper has evolved into a full-fledged code quality and analysis tool.
The most important feature of the newly released ReSharper 4.0 is full support for C# 3.0. In addition to intelligently analyzing C# 3.0 code features, ReSharper 4.0 provides assistance in helping migrate to the latest version of C#:
Including LINQ, implicitly typed locals and arrays, extension methods, automatic properties, lambda expressions, object & collection initializers, anonymous types, expression trees, and partial methods...
New warnings to comply with best C# 3.0 practices, including "Anonymous method signature is not necessary", "Redundant anonymous type property explicit name", "Redundant braces in collection initializer", "Redundant explicit type in array creation", "Redundant lambda parameter explicit type specification", "Redundant lambda signature parentheses", "Redundant 'partial' modifier on method declaration"...
A feature IntelliJ IDEA users have long benefitted from is extremely fast code analysis that aids the developer in code completion and instant defect analysis. ReSharper brings similarly fast code comprehension features to C#, mainly by supplying its own metadata to the .NET libraries:
We have analyzed a great share of .NET Framework Class Library, as well as NUnit Framework, and annotated it through external XML files, using a set of custom attributes from the JetBrains.Annotations namespace...
Having members of the standard class library readily annotated increases the efficiency of code analysis that ReSharper carries out. For example, StringFormatMethodAttribute is used to annotate String.Format-like methods the way that ReSharper checks the number of provided arguments against the structure of format string and warns the user if a necessary argument is missing...
In addition to insight into the .NET libraries, ReSharper has a view into an entire .NET project as well:
Suppose that you changed the visibility of a member from public to internal, assuming that it was only used inside the current assembly. At this stage, ReSharper finds no errors in the current file. Then, you switch on Solution-Wide Analysis and the circle indicator in the status bar turns red. You jump to the next error in solution and you find out that someone used this member from outside of the current assembly. You make necessary amendments, and that's all... No need to compile, then look for errors, then fix them, and finally repeat the whole process over and over again.
While ReSharper provides extensive refactorings, several of those can be grouped together into an automatic code clean-up task:
Code Cleanup is a shortcut for a dozen of ReSharper features — in addition to fine-tuning formatting style to use, you can opt to arrange 'this' qualifier, remove code redundancies, convert properties with backup fields to auto-properties, make fields read-only if possible, optimize using directives, shorten qualified references, update file header, replace explicit types with vars, and revamp your C# code with many more settings. For VB.NET, you can optimize 'import' directives, shorten qualified references, and reformat your code according to a formatting style. Code cleanup works in batch mode, so that you can instantly clean the whole project or even solution.
In addition, ReSharper provides an extensive list of refactorings, such as:
Convert Static to Extension Method
Convert Extension Method to Plain Static
Convert Property to Auto-Property
Convert Anonymous to Named Type
Inline Method
Convert Method to Indexer (to Default Property in VB.NET)
Convert Indexer (Default Property in VB.NET) to Method
Convert Method to Property
Convert Property to Method
Pull Members Up
Push Members Down
Extract Interface
Extract Superclass
Convert Interface to Abstract Class
Convert Abstract Class to Interface
Extract Class from Parameters
Use Base Type Where Possible
Replace Constructor with Factory Method
What do you think of ReSharper 4.0's support for C#?