Saturday, July 4, 2015

Visual Studio - Resharper Code Snippet for Method


It have bugged med a lot lately that there is no default method template snippet in Visual studio.
How this can even be is beyond me, but I found a neat solution:


In Template Manager in Resharper you can easily add this method yourself. Here:



Click create New Template in the Templates Explorer.
This will add a strange file in the background that you can edit and it has No Name as default this name is to be replaced with your snippet name. So just fill in the Shortcut: box to the right.
And add the code into the template and save.


This is the code for a simple method snippet with changeable return type:



After this just go ahead and save and restart visual studio.
Now within a class just type method to write the method head and then go to the method body.

No comments:

Post a Comment