Types of templates
There are several types of templates that you can use with ReSharper:
Live/Surround templates can be used for generating code in existing files and (if there is the
$SELECTION$parameter in the template body) for surrounding code fragments with template code, such as
Each live template is identified by a Shortcut — a short string of characters, for example
foreach— that you can type right in the editor to invoke the template.
.nullafter an expression and ReSharper will create an
ifstatement that checks the expression to be null. For more information, refer to Postfix templates.
Source templates, which are only available for C#, can be created right in the code of your project as extension methods. As soon as you define a source template, you can pick it up in the completion list of corresponding types, similarly to postfix templates. For more information, refer to Source templates
File templates are used to create one or more new files with predefined code, such as a type declaration, unit test, and so on. File templates have no shortcuts, they are identified by their descriptions. For more information, refer to Create files from templates and Create multi-file templates.
This feature is supported in the following languages and technologies:
The instructions and examples given here address the use of the feature in C#. For more information about other languages, refer to corresponding topics in the ReSharper by language section.