Resharper is perhaps one of my most frequently used tools, I use it every day and It is one tool that I have gotten so addicted to over the years that I find it very hard to work on a machine where Resharper is not installed. Today I will share with you some of the Resharper features that I use every day and I find very useful. I am using Resharper’s IntelliJ key bindings and NUnit project, so the short keys I mention will be different for you if you are using the C# key bindings.
Navigation
A lot of people think of Resharper as a refactoring tool only but it is also a powerful tool to navigate around a large codebase.
Navigate to Class / Type
Pressing Ctrl + N will open the Goto menu, here you can enter the initials of your class name for example if your class name is TestFixture, you can enter “TF” and Resharper will filter out all classes that match this criteria. If there are multiple classes that start with TF then you can enter more character to filter out your desired class. Simply select your desired class from the list and hit Enter to go to that class.
Navigate to Method
If you are inside a class and want to go to one of the methods inside it, you can press “Ctrl + F12”. This will open the Goto Method menu, where you can enter the initials of your method name to filter them out. If your method name is “Debug”, you can enter “D” and Resharper will filter the method for you. Simply select the method in the list and press Enter to navigate to it.
Navigate to File
A lot of time you want to go to a specific file. For example “Web.config”. With Resharper, navigating between files is also easy, simply press “Ctrl + Shift + N” and enter your file name initials. Resharper will filter all files matching your criteria and you can simply select and press enter to go to that file.
Navigate To Base Class or Interface
If your class inherits from another class or implements any interface, you can navigate to them by simply placing the cursor on your class name and pressing “Ctrl + U”.
Navigate To Derived Class Or Interface
If you want to see which class inherit from a class or implement an interface, place your cursor on class / interface name and press “Ctrl + Alt + Shift + B”.
Move To Folder
This is my personal favorite feature in Resharper and especially useful if you are doing Test Driven Development. When I am writing tests, I will just generate all the code in the same test class and later when I want to refactor the test, I will move out each class to it’s appropriate library or folder. To do this place your cursor in class name and press “Ctrl + Shift + R” this will bring up the Refactoring menu, from there select “Move To Folder” option and press Enter. Enter the name of the Library or Folder that you want to place your class in and click Next. Resharper will automatically take care of adding the references of this class where it was being used 🙂
Surround With
How often do you write code that you want to surround in a try catch block or a loop? Next time you want to do that just select the code and press “Ctrl + Alt + J”. Resharper will show you a list of common code blocks that you can use, just select the one you want to use and press enter.
Move Property Up Or Down
If you want to move any property or method up or down in you file, just place the cursor in its name and press “Ctrl + Alt + Shift + Up/Down”. What I love most about this feature is that if you have Summary comments written on top of your property or method, Resharper will move them too, Yay!
Property With Backing field
Sometimes you create an auto Property and later want to convert it to property with a field, you can simply place your cursor on property name and hit “Alt + Enter”, from the list of options that you will get select “To property with backing field”.
Extract Interface
A lot of times I start with class and later extract its interface, it is extremely simple to create an interface from an existing class. Simply place your cursor over the class name and press “Ctrl + Shift + R” to bring the refactoring menu, from here select “Extract Interface” and in the dialog window that pops up, enter the name of Interface and the methods that you want to extract in it and hit Enter.
These are some of my favorite features that I use every day in Resharper, I cannot cover all of Resharper’s features in a single post, you can really write a book on them! But if you feel there is something that should be here please comment below and feel free to share with me your own Resharper tips 🙂