ReSharper Web Help

Simple templates are expanded into predefined text independently of the context in which they are used. After the template code is inserted into your source code, you resume typing at the position specified by template developer. However, the most powerful feature of live templates is their ability to adapt to the surrounding context.

When invoked and expanded, parameterized templates suggest reasonable choices at the input positions of template variables. For example, a well-designed parameterized template for an iteration over all elements of a container will suggest:

  • A suitable name for the loop index variable (for example, i or j).
  • A list of all variables of the specified type in the current scope (for example, Arrays or Lists) as an expression for the iterated container.
  • A suitable name for the assigned variable that will hold the current container element during the iteration.
  • The type of elements in the iterated container.

When a template that requires user input is expanded, the code editor temporarily switches into the template editing mode that lets you specify values for template variables (see also Creating Source Code Using Live Templates ). The template variables can be either replaced with your input or calculated by ReSharper based on the input or the surrounding context. In the template editing mode, each template variable corresponds to an input position in the editor.

To learn more about parameterized templates, see Predefined Live Templates . Usage of parameterized templates and user input fields is described in Creating Source Code With Live Templates  and Surrounding Code Fragments With Templates .

See Also

Procedures

Reference