Code Templates

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


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 tool window or the Templates options page.