Skip to main content

Code Templates

  • 2 minutes to read

Code templates are blocks of code that expand from short abbreviations typed into the code editor. Using code templates decreases code creation time, because it helps avoid having to type the entire code manually and allows you to create regular code sections with only a few keystrokes.

CodeRush Classic includes a powerful library of simple code templates and their combinations. This library is available in C#, VB, C++, HTML, JavaScript, and XML.

To expand a template, type in the template name and press Space. For instance, to declare a method returning a string, type in “ms” and press Space.

msTemplate

Code templates are context-sensitive. That is, a single template expands appropriately for different contexts. For instance, the “mb” template declares a Boolean method inside a class, or generates a call to MessageBox.Show() inside a method.

You can customize existing templates and create new templates in the Templates options page. The templates are grouped into categories and subcategories that enable you to easily find desired templates or categories.

You can find the information on the most high-usage templates in the following topics.

For the information on other templates, see CodeRush Classic tool window or the Templates options page.