Resharper is one of the most widely used utility for the .net Developers who use Visual Studio,it can be either VS2005 or VS2008.Every person who wants to be more efficient,productive and do smart coding should always use refactoring. Although VS2008 has bunch of refactoring features inbuilt but they are not sufficient if you do a lot of work in Visual Studio.For this kind of situations Resharper is a must have add-on and its price is worth its value. In this series of my articles i will try to explain you with many of its features related to refactoring and some of its other powerful stuffs. Although there can be a learning curve in mugging up some keys but once you practice them in your daily coding and make it a habit, you will find that your productivity has increased a lot.
First Let’s See some of the Code Generation Techniques using Resharper
- Creating File from Template
- You can just press Ctrl+Alt+L to open the solution Explorer
From inside the solution Explorer just press Alt+Insert to open the generate file from Template smart navigation as shown below
3. This will create a new Class called Person and put it inside the required Namespace.
4.You can create a new class,Interface,Structure in the similar fashion.
Surround With Template
- Just Select the region you want to Surround with a region and then press Ctrl+E,U
To remove the region surrounding again to its original just press Alt+Enter on the region bubble and Press Remove Region
Code Assistance And Analysis using Resharper
- Show available quick fixes and context actions
- Most of the times you will make use of this shortcut,whenever you see a bulb in front of your code line you can just press Alt+Enter to see related quick fixes and context actions.
- Symbol Code Completion
- Shortcut for symbol code completion is Ctrl+Space
- Code Cleanup
- Resharper includes a code cleanup module which can clean up your code according to some predefined set of rules
- Just press Ctrl+E,C prompt code cleanup and press Ctrl+E,F for silent cleanup
- Extending And Shrinking the Selection
- For extending the selection just press Ctrl+Alt+RightArrow
- Fore shrinking the selection just press Ctrl+Alt+LeftArrow
- Comment with Line Comment
- Just Press Ctrl+Alt+/ to comment with line comment.
- Comment with Block Comment
- Just Press Ctrl+Shift+/ to comment with block comment.
- Duplicate or Copy and paste a line ore selection
- Just press Ctrl+D to duplicate the selection or the line and this duplicated copy is inserted just after the line which is duplicated.
If you are new to Resharper you can download it from the below given link http://www.jetbrains.com/resharper/download/ Rest of the techniques will be covered in next article in this series which will be related to search assistance and navigation techniques using Resharper. So stay tuned for more ……… Happy Programming!!!!