CodeRush Standard Templates Library
The standard templates library contains more than one thousand static code templates designed to help you realize any coding requirements. Templates are organized by categories. For instance, there are over 25 root categories for CSharp language on the Templates option page, such as:
- Program Blocks
With the dynamic lists capability, the number of code templates can total in the tens of thousands. Having learned the template language, it is easy to remember and write code using templates very quickly.
Here are some basic code templates from the library you can start with.
Type declaration templates make it easy to generate classes, structures, interfaces, enumerations, etc. They are available in the corresponding context (condition), e.g., on an empty line inside a namespace.
Member declaration templates allow you generate new methods, properties, fields and events.
Note that the ‘v’ template may declare not only fields, but also local variables and parameters depending on the current context. In combination with the dynamic list of standard types, you can specify the desired type of a member using an additional type specification mnemonic:
Loops and blocks
Code templates for quick generation of loops such as ‘for’, ‘foreach’, ‘while’, ‘do’ and other code blocks like ‘if’, ‘switch’, ‘try/catch’ etc.
|Mnemonic||Loop or block|
|f||The ‘for’ loop|
|fe||The ‘foreach’ loop|
|w||The ‘while’ loop|
|dw||The ‘do/while’ loop|
|if||The ‘if’ block|
|sw||The ‘switch’ block|
|tc||The ‘try/catch’ block|
|tcf||The ‘try/catch/finally’ block|
Code templates for generating a return statement with the desired return value.
Note that the ‘r’ template will execute the Smart Return feature. This feature allows you to quickly select the return value from the suggested values (e.g., local variables).
You can see the full collection of code templates for each language on the Templates option page.—– Products: CodeRush Pro Versions: 12.1 and up VS IDEs: 2008 and up Updated: Oct/23/2012 ID: C207