ReSharper Web Help

With ReSharper, you can create live templates based on a fragment of your source code. In so doing, ReSharper suggests variables to be used as input fields when the template is applied. The new template is stored in ReSharper | Live Templates | Live Templates | User Templates.

To create a live template from a code fragment
  1. In the editor, select a block of code to create a template from.
  2. On the main menu, choose ReSharper | Tools | Create Live Template from Selection. In the Select Fields and Context for New Template dialog box, ReSharper suggests a draft for the new template, along with optional list of template variables .
  3. If the Template Variables section contains entries, deselect variables that you think ReSharper shouldn't use as input fields. As you select or deselect variables, the Template Text section changes accordingly.
  4. In the Context drop-down list, select the context where the new template is applicable.
  5. Click Create and Edit.
  6. In the Template Editor code pane, enter template shortcut, optional description, and specify formatting options. Modify template text if necessary. See Creating a Template for details.
  7. In the list of template variables to the right of the text area, choose macros for variables, or create them from scratch if ReSharper failed to guess them from selection. See Declaring Variables for details.
  8. On the main menu, choose File | Save Selected Items, and close the Template Editor code pane.

See Also