Add a Template

You can use the code editor's context menu to create a template from code.

Follow the steps below:

  • Select code.

  • Right-click the selection and choose Selection to Template...

Templ_from_Sel1

Note

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.

Templ_From_Sel3

  • Select the template's category. Right-click a category to add a new one.

AddCategory

  • Specify the Category name and click OK.

NewCategory

  • 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.

Templ_from_Sel2

This opens the new template in the Template Editor.

  • Make changes to your new template, and click OK to close the Template Editor. Templ_from_Sel2

  • Expand the created template. See the Expand a Template section of the Code Templates topic for more details.

Templ_from_Sel2

Refer to the Custom Template Creation sections for details on how to edit existing templates and define the new ones manually.

See Also