Add a Template
- 2 min to read
You can use the code editor's context menu to create a template from code.
Follow the steps below:
Right-click the selection and choose Selection to Template...
You can use the Multi-Select feature to mark parts that are used as Text Fields when CodeRush created a template. You can use the MultiSelectAddPoint command (the shortcut is disabled by default) to place an empty text field. CodeRush can also store dropped markers in the generated template.
- In the Create Template From Selection dialog, specify the template options and choose for which identifiers CodeRush should create the links. Click Next to proceed to the next page.
- Select the template's category. Right-click a category to add a new one.
- Specify the Category name and click OK.
- Enter the template name that corresponds to its mnemonics and click OK. You should type the template name in your code to expand the template.
This opens the new template in the Template Editor.
Make changes to your new template, and click OK to close the Template Editor.
Expand the created template. See the Expand a Template section of the Code Templates topic for more details.
Refer to the Custom Template Creation sections for details on how to edit existing templates and define the new ones manually.