ReSharper Web Help

With ReSharper, you can create live templates based on a fragment of your source code. ReSharper automatically converts some fields into template variables that can be used as parameters when the template is applied.

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.
  3. In the Select Fields and Context for New Template dialog box that appears, ReSharper suggests a draft for a new template and automatically converts some fields into template variables:
  4. If the Template variables section contains any entries, you can check where they are used and what they replace in the Template text view.
  5. If you think that some variables are unnecessary, you can deselect them so that the original code is used instead. As you select or deselect variables, the Template text view changes accordingly. If you are unsure whether to use the suggested template variables or not, study the Template Variables section. Also, you will be able to introduce other variables into the created template in the next steps.
  6. In the Context drop-down list, select the scope where the new template will be applicable.
  7. Click Create and Edit.
  8. The new template will be opened in the Template Editor and you can proceed with its creation as described in the Creating a Template section.

See Also




External Links