First off, Resharper 3.1 (R#) is not a stand alone application, instead its integrated into Visual Studio (VS) 2005. I recently installed VS2005 on a new laptop, soon I realized that the features I love the most are not part of VS, but were, in fact R#, features. Little did I know I was a full R# addict. Quickly I downloaded and installed the 30-day trial version. The first hit is always free, no? My plan is to convince my employer to purchase it before the trial version expires.
For a full description of Resharper 3.1 visit their website, but Ill summarize the features I use and enjoy the most.
Enhanced Intellisense
With R# lots more code is `intellisensed. Based on where in the code file you are typing R# presents context relevant choices. For example, at the beginning of a new code file R# presents choices for type modifiers – public, private, internal, etc. Then the user can select the type and modifiers – class, interface,struct, abstract, virtual etc.
R# will show you all the overloads of a methods along with the parameters. And if you type a method name that doesnt exists R# flags the error, but also gives you the choice of automagically creating the method.
If you use an object that is not referenced (using statement) R# will show a compile error. In this case a Cannot resolve symbol error, but click the R# hover box and the using statement is inserted at the top of the code file. This is helpful because I often cant remember what namespaces/libraries contain the object I need. For example, with one click R# will add
using System.Text; (if its not there) to the code file when I type `StringBuilder sb = new StringBuilder();
Continuous Compile
Because R# is continuously compiling, errors and warnings show up immediately. Overall its a great feature, but at times its annoying. I dont need to be reminded that half written code wont compile. But R# does make intelligent guesses about how to fix or complete the code. When working on a code file R# gives a visual indication of suggestions, warnings and errors. Click on the warning bar and R# takes you right to the problem. Hover over the warning bar and the error text pops up. When writing code I find myself frequently checking the R# status light to make sure its green – no warnings or errors. As expected the user can configure R# to ignore various warnings.
Code Generation
Suppose you write some code to find the first day of the week. In this case, Monday:
int i = ((int) DateTime.Now.DayOfWeek) – 1;if (i
Later you need find yourself needing this code in another place. No problem. Highlight your code, right click and select Refactor –> Extract Method. Then define the new methods signature and boom its a new method. Even the calling is written for you.
Now suppose you need some code in a try{} catch{} block. Highlight the code, right click, select Surround with –>
try. And theres your code in a neat tidy try{} catch{} block.
If your classes often implement interfaces, youll love this next feature. With one click R# will stub-out the interface contract for you, either explicitly or implicitly.
Renaming identifiers (class names, interface names, variable names, etc.) is so handy. Over time an identifier might no longer reflect its use. But with one click R# will update the name wherever its used in the solution, including comments.
The R# context menu has an option to quickly reformat code, which gives you several choices. “Optimize using statements” will remove using statements that are not used. “Shorten references” will remove unnecessary qualifiers. “Remove redundant `this qualifier” is self explanatory. Type members can also be reordered. Whats really powerful is that this quick reformatting can be done at the file, project or solution level.
No Free Lunch
Ah yes the dark, dirty side of R#. OK really its not that dirty or dark. But there are a couple of items worth mentioning. When loading or reloading a project, R# creates in-memory indexes of your code. My current solution has 17 projects and roughly 400 files. With R# enabled this solution takes an extra 5-10 seconds to load, about the time it takes me sip my coffee. Expect VS2005 to use more memory as well, roughly 10% more. My development machine easily absorbs this, but it has 3Gig of RAM. The most annoying thing R# does is remap the shortcut keys. Jeez, I hate that. After installing R# I reset VS2005 back to the default shortcut mappings, takes like three clicks. Again no biggie. Then I create some shortcut keys for the R# features I use the most.
I dont intend to give a complete description of R# (check their website), just highlight the features I like the most.