ReSharper supports three types of code templates:
- Live templates represent code fragments that can be quickly inserted into your code. The code of the template can be a short expression, a complete construct, or even an entire class or method. Each live template is identified by a Shortcut - a short string of characters such as foreach - that you can type right in the editor to invoke the template. For more information, see Creating Source Code Using Live Templates.
let you quickly enclose an expression, a single statement or an arbitrary
block of code with a predefined code construction, such as
try...catchstatement. Surround templates have no shortcuts, they are identified by their descriptions. See Surrounding Code Fragments with Templates for details.
Postfix templates, which are only available for C#,
help you transform expressions that you have already typed without jumping backwards.
For example, you can type
.nullafter an expression and ReSharper will create an
ifstatement that checks the expression to be null. See Postfix Templates for details.
- File templates are used to create one or more new files with predefined code, such as a type declaration, unit test, etc. File templates have no shortcuts, they are identified by their descriptions. See Creating Files from Templates and Creating Multi-File Templates for details.
This feature is supported in the following languages/technologies:
The instructions and examples given here address the use of the feature in C#. For details specific to other languages, see corresponding topics in the ReSharper by Language section.