I have to say that I’m a big fan of ReSharper plugin (or maybe a better word: tool) for Visual Studio. I’ve been using it for almost 3 years now. After this time I can only say that I’m really angry if I have to code in VS without ReSharper. Working with it is a pleasure and every .Net developer should at least try it, you don’t regret it!
To give only a small overview of its potential I will describe here 10 functions that I use the most:
(ReSharper allows us to use one of two keymaps: Visual Studio scheme or IDEA scheme. In all my description I will use VS scheme)
-
Go to Type (Ctrl + T)
In my work I usually know a name of a class I’m looking for, but I don’t know where it is (in which project, folder etc.). The solution is very simple: I hit
Ctrl + T
and I start writing class name – ReSharper shows me all matching types, I only have to select the one I need.
In the editor we can use special characters that can substitute zero or more characters (*), zero or one character (?) and one or more characters ( ) -
Go to Inheritor (Alt + End)
As the name says, it allows us to go to the inheritor of selected class. After hitting the shortcut you get the dialog with all inheritors. Especially I like it when I see an interface in code and I want to go to its implementation. Really cool!
-
Find Usages (Shift + F12)
It helps find all usages of a class, method, property and any other object in code. With this functionality we can easily understand where and why any object is used.
-
Locate in Solution Explorer (Shift + Alt + L)
As I wrote before I use “Go to type” all the time, but sometimes when I work with a file in Visual Studio I need to change one of its properties or simply see in which folder in solution it is. Everyone who works with VS knows that finding a file in big solution is frustrating, with this option it won’t be anymore. Simple use this method for opened file and it will be highlighted in solution explore.
-
Create from Usage (Alt + Enter)
Another great feature of ReSharper. Let’s assume you’re writing a code in VS that needs to parse some string variable. So you can write something like this:
string number = ParseMyVariable(someText);
The name of the method will be marked with red, so you can simply hit
Alt + Enter
and select:Create method ParseMyVariable
, RS will create method with good signature for you.
-
Symbol Code Completion (Ctrl + Space)
This function is great for lazy people (yes, I’m and I use it all the time). Again I will show it by example: I need to create instance of
SqlCommand
, so I writeSqlCommand
and hitCtrl + Space
, after that ReSharper will suggest me possible names for a variable. I only need to select the one I like. The names are usually very smart created, so forSqlCommand
proposition will becommand
orsqlCommand
-
Rename (Ctrl + R, R)
I can’t say much about it, because the name tells everything. It changes the name of a symbol (method, class, property and so on) in every file it is.
-
Introduce Parameter (Ctrl + R, P)
Sometime, during refactoring we need to change a local variable to the method parameter and this function is great for this. The best is that ReSharper will try to change every invocation of the method by adding appropriate parameter – it takes it value from the context.
-
‘Surround With’ Templates (Ctrl + E, U)
I use it usually when I need to add *try…catch *block or a region in code (there is more build in statements). To do it I select a part of a code, hit the shortcut and select the statement I want – rest is done automatically (ex. code is nice formatted)
-
Go to File Member (Alt + \)
It allows us quickly go to any file member:
- method, property, field for a class
- node element for xml file
So this is my top 10 of ReSharper features and what is your? Or maybe you’re big fan of CodeRush if so please write me why it’s better then ReSharper.