with it before then, but I didn’t learn enough to get the full benefit. I want
to thank Steve Donie and Jeremy Miller for helping me to learn the full
featureset of the product. I can’t imagine coding without it now. I’m using
Resharper 2.0 (with VS 2003 as well as VS 2005), and I’m not going to talk
about what features are different from 1.5 because v1.5 has all the features I
will talk about here.
Resharper is a refactoring tool, yes, but that seems to be a
small portion of it. It is an overall productivity tool. It does some
code-generation, some fill-in-the-blank, some extract method/variable, some
move method, some create method/property/constructor, and a whole lot of
helping you with the job of programming.
You can certainly use the mouse with
this tool if you wish, but the shortcut keys make me so productive on the
keyboard that I don’t have to slow down and reach for the mouse.
I’m going to go over the features that I use. I’ve created a test project using the Movie application that comes as an example in VS 2005. This is not
an exhaustive list, and it isn’t every dialog, but I use these all the time.
Every screenshot is inside Visual Studio in the code window. Here is the menu
for Re#er. It has the standard things.
You’ll notice in the screenshot that two using statements
are grayed out. These are unnecessary. There is no code that requires these.
They are visual noise. Let’s get rid of them. CTRL+ALT+O
Resharper has so many formatting options that (if it’s
important to you) you can share settings with the team so that all code looks
But that not all there is. Re#er will include optimize usings,
shorten System.DateTime to DateTime, remove unnecessary “this”
keywords and put your “virtual public void” back to “public
virtual void” (if you have a boneheaded programmer that left it like
Find code file
Why go for the solution explorer when you know the class you
Just start typing, and Re#er will narrow down the list as you type. You
can take a shortcut and type “*Tester” to find all your NUnit
Now you need to open one of your NHibernate mappings, but
it’s not a code file.No problem. Just narrow down from all files. CTRL+SHIFT+N
How many times have you wondered how many classes in your
solution are calling a particular method on IConfiguration. Is it used at
How much? Do you have any hope to change it without major regression?
Find out who is using it easily and jump right to the usage, all from the code
You will typically know what you want to do, and Re#er will
be there waiting for you. Stick the cursor on a member name and choose from
the refactorings available there. One of my favorites is “Change
It makes it easy to add an extra parameter to a class
constructor, and Re#er will add it in all the places where that constructor was
Ever wondered if you needed to clean up the class a bit?
Re#er keeps a running tab on errors and warnings in the upper-right hand corner
of the code window. When things are good, it will stay green. It’s always
You know you need to go to your default implementation of
You know, the one that actually reads from app.config? Your
entire application uses IConfiguration since you don’t want to tightly-couple
to the app.config file.
Sometimes you just want to pop over to whoever
implements the interface or inherits from a class.No problem. Place the
cursor on the interface (or class) name and find who inherits. CTRL+ALT+B
Wherever you are, if Re#er can help, it will show you a
yellow lightbulb or pop up a suggestion. If you like what it shows you, give
Re#er the go ahead and continue without missing a beat. in this case, I need
to add a using statement.
Isn’t it annoying to stop your flow just to go up to
the top to adding a using?
Now you don’t have to. With all the
context-sensitive helps, and whenever there is a lightbulb, just press: ALT+ENTER
The red lightbulb is a context-sensitive help that is also a
Go ahead and fix the error quickly (or just let Re#er do it for
you). In this case, I really wanted to match up types, but I made a mistake. ALT+ENTER
These are like code snippets but much simpler, and they have
been a Re#er feature for a long time, so just because VS 2005 has a similar
feature that is harder to use doesn’t mean that I should stop using my
templates. I have created templates for common things like creating a new
NUnit test fixture and a test method. In this example, I have typed
“foreach”, and Re#er awaits to take it from there. Here is a before
and after. CTRL+J
I always call my IDomainRepository “repository”
when using it in a method. I like descriptive variable names, but it takes
more typing. . . but not with Re#er. After the type name, just ask Re#er for a
Pick from the list. CTRL+SPACE
Show Class Members
When you are in a class you want to remember what is there
and jump to it quickly. Use Re#er to move around quickly. CTRL+F12
If you want to jump between files that you have recently
opened, just pull up the list and arrow down to the one you want. CTRL+E
Dead code detection
If code is dead, delete it. It’s never a good idea to save
code for a rainy day. It just pollutes the codebase. Re#er will color it gray
for you. Let it help you keep the codebase clean.
I saved this one for last because it’s my favorite one.
This is a micro-code-generator. It will create a property/constructor, etc
exactly the way I would have typed it. In that case, why do I want to type
Imagine this: You have a new domain class with 8 fields. Do you really
want to type those 8 boring properties and a constructor? I don’t. A few
shortcut keys, and the class is done. ALT+INSERT
[tags: programmer, programming, resharper, jetbrains, productivity, c#, .net, vs2005, visualstudio]