Resharper Templates – supercharge your coding

Resharper_AltInsertResharper can help with a lot of repetitive tasks which can take a bit of time everyday. For example, the templates provided by Resharper are quickly available by using Alt+Insert when a project/folder/class are selected in the Solution Explorer, an example shown on the right. This will give you options as per the item selected on the solution explorer. In the example given here, the entries for “MS Test class” and “NUnit Test class” are custom file templates, which will not be available out of the box. Their creation is explained below.

The options provided here are the Resharper templates which can be edited by selecting the Resharper –> Templates Explorer… menu. This gives the Templates Explorer screen where the Live, Surround and File Templates can be selected, as shown below. The New/Edit Template Icon can be used to create/edit the respective type of template.


To add standard repeated items like copyright to a class/enum, click on File Templates sub-tab in the Templates Explorer tab, select C# in the Scopes column on the left, and double click the Class/Enum item, which should be at the top of the ‘In quicklist’ items on the right.

This should open up the edit template tab where anything that’s needed for all class definitions can be added. So if the copyright is added as shown, it will come up for each class created and would replace the class name where the $CLASS$ item has been added.



The $ enclosed words are parsed as macros by Resharper and can be selected by clicking the link for the respective macro shown on the right hand side of the edit template screen under Parameters sub-section, as in the picture above. Clicking on the link brings up the “Choose Macro” dialog box shown to the right.

The above process will have to be carried out for any other file templates e.g. enum to get the same copyright etc.

Live templates are templates available in the files and are used by typing their shortcut and pressing the tab key. This will print out the template with ‘hotspot’ (the place to type code) at the first of the macro location. The other locations can be accessed using the tab key.

To create a new live template, like for NUnit test class, select Live Templates tab in the Templates Explorer and click on the icon for New Template shown before. Here the Class template can be copied over and alterations made as needed for a NUnit test class. The macros will have to be selected under the Parameters sub-section above. The resulting dialog ‘Choose Macro’ dialog box is shown.

The $END$ is a Resharper macro where the cursor is placed after all the editable parts of the template are filled one by one by using the Tab key. This allows continuing the flow of typing while filling in a template.


Creating a template as explained above will create a new template as named under the ‘Not in quicklist’ section on the right when Templates Explorer is opened and C# selected. To show this template in the quicklist drag the template into the ‘In quicklist’ section. This will show the template when Alt+Insert is clicked after selecting an artefact in Solution Explorer.


Sharing the templates: To share the templates, select Resharper –> Manage Options… and click on Import/Export Settings –> ‘Export to File’ option highlighted on the right.

Then the relevant settings to export can be highlighted, select OK and provide an appropriate name for the file to share.

To import the settings select the ‘Import from File’ option from Resharper –> Manage Options… –> Import/Export Settings and choose the file required.

This will bring the appropriate templates in the C# section but only in ‘Not in quicklist’ section in the Templates Explorer. To see them on pressing Alt+Enter at the right location, drag the template into the ‘In quicklist’ section from Resharper –> Templates Explorer –> File Templates –> C#.


Platforms and Services: why you(r company) need(s) them

This is a gist of the Steve Yegge‘s phenomenal(ly long) Google Platforms Rant, which lists the only three things he thinks were done well by his former company and are the only things his current company hasn’t got right. The most important of these was Platforms. The hows & whys are a fascinating and a long read and the discourse is much posted on the internet. Steve has since offered his apology/follow up to the accidental disclosure of what was supposed to be a private memo. At least that’s my understanding of the story, as are the following lessons from the post, laid out for those short of time.

Continue reading

It’s all my fault – own All your work


It's not how good you are, it's how good you want to be.
What more can you ask for…
This post springs from one of the ideas in “The world’s best-selling book”, some of which are listed here. Rather pithily, this one states: It’s all my fault.
Which is the author’s way of asking you to take total responsibility for any piece of work you have touched. As the book continues: “If you accept responsibility, you are in a position to do something about it … … There are no excuses.”

Coding Dojo

The first Leeds Coding Dojo on 09 July 2014 was an almost packed affair. The problem to tackle, in a language of our choice, was price calculation for books with different discounts given for buying different books – out of a choice of 5 different books. No discount is given for the same book being bought more than once. And before I forget – TDD and pair programming to be followed throughout the exercise. More details in the slides here.
It was refreshing doing proper TDD as per the three cardinal rules while focusing on the technique and proper pair programming. Some of the first set of work done is posted at github if anyone’s interested.

Continue reading

Try some monads today

One quality I like in code is easy/quick grokability – from the work grok – to understand thoroughly and intuitively. That is usually enhanced if the code consists of well spaced and familiar lines of code with minimal interruptions – like if/else statements that need their own branches in the method.Every one of these interruptions break the reading of the code and the brain has to make note and focus to see if there’s anything worth noting in the branch inside a method. What can help in structuring code better for grokability are monads. Continue reading