Templates
ReSharper provides you with a very powerful template mechanism that generates code for the most commonly used actions, such as creating a new class, constructor, and the const
variables.
Templates as snippets
Visual Studio provides you with simple templates called snippets by default. ReSharper extends these templates with Live Templates. Live Templates can be accessed using the Ctrl + E, L shortcut or by using an associated name.
Do you need a GUID? Just write nguid
and press Tab. Do you need an iterator? Write iterindex
. Maybe you need to override the Equals()
method? Write equals
.
By pressing Ctrl + E, L, you can review all the available Live Templates.
File template
With Live Templates, you can generate some parts of code but ReSharper allows you to generate whole files too.
Creating a new file from a template can be done by pressing Ctrl + Alt + Insert in the code editor or by pressing Alt + Insert in the Solution Explorer.
Customization
Each ReSharper template can be configured....