Expand a Template
Type the template name and press Space to expand a template.
For instance, type in "c" and press Space to create a simple class in C#. This creates a new class and prompts you to name it (CodeRush names the constructor automatically).
You can also expand templates with the Tab key.
Use one of the following ways to bind the "TemplateExpand" command to the Tab key:
The Setup Wizard (available from the CodeRush -> Setup Wizard... options menu).
Shortcuts... items (available from IDE -> Shortcutsoptions page).
The example below shows how to expand the "g3x2" template with the Tab key in XAML to create a grid with three columns and two rows.
The default CodeRush configuration does not interfere with Visual Studio features such as IntelliSense. IntelliSense prevents the Space or Tab key from expanding templates because this key confirms the IntelliSense suggestion. You should press Esc to close the IntelliSense suggestions window and then press Space to expand a template. You can also force the templates to expand in the IDE | IntelliSenseoptions page.
Code templates allow you to declare typed members and variables. For example, you can add a type mnemonic to each member template or variable template to make it expand to the correct type. The screencast below shows how to expand the "ps" template to create a string type property.
CodeRush expands different templates depending on the context. For instance, you can use the "vs" template to create a string type member variable if the caret is inside a class.
you can create a local variable of type string if a caret is inside a method.
CodeRush allows you to see hints for some of the more common templates in the Training Window.
Use the CodeRush | Windows | Training menu item to access the Training Window.
Learn More About Templates
You can find more information on templates in the following topics: