Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Collapse]CodeRush Classic
  What's New
 [Expand]System Requirements
 [Collapse]Concepts
  [Expand]Code Analysis
  [Expand]Code Style
   Feature Advisor
   FrictionFree Mode
   Mastering CodeRush Features
  [Expand]Visualization Tools
  [Expand]Navigation
  [Expand]Advanced Selection Tools
  [Expand]Clipboard Tools
  [Collapse]Coding Assistance
   [Expand]Code Providers
   [Collapse]Code Templates
     Common Code Blocks
     Member Declaration
     One Key Templates
     Types Declaration
     XPO and XAF Templates
   [Expand]Refactorings
    AutoDeclare
    Automatic Declaration
    Comment/Uncomment
    Cycle Scope Up/Down
    Duplicate Line
    Embedding
    Intellassist
    IntelliRush
    Inversions
    Smart Constructor
    Smart Enter
    Smart Parens and Brackets
    Smart Paste
   Unit Test Runner
 [Expand]Visual Elements
 [Expand]Tool Windows
 [Expand]CodeRush Options
 [Expand]Examples
  Get More Help
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

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.

How would you rate this topic?​​​​​​​