Create a Live/Surround Template from Source Code
With ReSharper, you can create live/surround templates based on a fragment of your source code. ReSharper automatically converts some fields into template parameters.
Create a live/surround template from a code fragment
In the editor, select a block of code to create a template from.
In the main menu, choose.
In the Select Fields and Context for New Template dialog that appears, ReSharper suggests a draft for a new template and automatically converts some fields into template parameters:
If the template parameters section contains any entries, you can check where they are used and what they replace in the Template text area.
If you think that some parameters are unnecessary, you can deselect them so that the original code is used instead. As you select or deselect parameters, the Template text view changes accordingly. If you are unsure whether to use the suggested template parameters or not, study the Template parameters section. Also, you will be able to introduce other parameters into the created template in the next steps.
In the Context list, select the scope where the new template will be applicable.
Click Create and Edit.