Resharper has to be one of the biggest boosts I have found to my productivity. This tool has so many little time saving features that I will probably gain days of productivity every month.
For anyone that has not heard of this tool, Resharper is a visual studio add-in made by JetBrains that adds a plethora of time saving shortcuts.
I thought I would share a few of my favourites:
alt+enter
some context sensitive help. For instance if you write a line like this: ICustomer customer = new Customer();
and the Customer class does not exist you can hit alt+enter and it will generate the class for you.
alt+insert
Used to generate code in your class. If you had something like this:
public class Customer
{
private string firstName;
private string lastName;
}
you could hit alt+insert in your class and have a few handy options. The ones that I use the most are generate constructor which would create a constructor for the class based on the private fields
public Customer(string firstName, string lastName)
{
this.firstName = firstName;
this.lastName = lastName;
}
we can also use this to generate properties based on fields too!
public property FirstName { get; set; }
public property LastName { get; set; }
F2
F2 does a rename on whatever you have selected. It searches out all usages of that item and renames it. A neat thing to it as well is that it searches comments for that variable and will rename it in the comments if you so desire.
F6
F6 allows you to move things around easily. If you have a nested class in a class and want to move it to the outer scope you can easily do it. If you have 2 classes in one file and want to move one of them to its own file it will do that too as well as keep the namespaces and imports handy.
ALT+Space
This one is smart intellisense. Lets say you start typing this:
var sb = new StringBui
but you can't remember what namespace the stringBuilder class is in. Simply hit alt+space and it will show a list of classes that start with StringBui in everything you have referenced in your class. If you select System.Text.StringBuilder it will add an import/using statement for System.Text and complete the line for you.
CTRL+ALT+F
Reformats the current document. Based on what you select this can clean up using/import statements, fix any messy indentation, and even change types to use the var keyword where appropriate (if you like this setting). It is a handy tool to cleanup code in seconds
CTRL+B
This is a shortcut that will take you to the implementation of the item you are on (i.e. it works like right clicking and going to definition)
Those 7 commands I use fairly often and just starting there will save lots of time. There are hundreds of other shortcuts and features in Resharper which makes it such a productivity booster that I have no idea how I worked without it.