Archive

Archive for the ‘Code Generation’ Category

Code Templates – NUnit testing

May 17th, 2011 Comments off

Just a list of NUnit-testing CodeRush code templates useful for test-driven development. Bear in mind, if you have an identifier on the Clipboard, assert templates will automatically paste the identifier from the Clipboard as an argument to the assert call. The meaning of the text commands in bold can be seen in the corresponding topic.

Read more…

Code Templates – ASP.NET MVC development

May 16th, 2011 Comments off

The 10.2 release of DevExpress IDE Tools (CodeRush Pro) has introduced a number of templates for MVC development. They include templates for C#, VB and ASPx (C# and VB) code. CodeRush text commands are marked as bold in template expansions, see the list of all text commands, to learn more.
Read more…

Code Templates – Using/Imports directives

May 11th, 2011 Comments off

Here is the list of CodeRush using (C#)/Imports (VB) specific code templates. The templates below generate namespace reference declarations. Templates start with the letter “u” (the equivalent templates start with the letter “i” in VB). To add a namespace, just enter a “u” followed by the uppercase letters of the namespace. For example, to add a reference to “System.IO”, use “usio”.

These templates can be found on the Editor | Templates options page in the Options Dialog. Expansions containing several values in parenthesis will be enumerated using the CodeRush Intellassist feature: pressing the Tab/Shift+Tab keys will switch to another value.

Read more…

Code Generation – Add Missing Constructors code provider

April 26th, 2011 Comments off

The Add Missing Constructors code provider from CodeRush allows you to add constructors from the ancestor class to the current class or structure, which are not implemented.

Imagine you are creating a descendant of the System.Exception class:

CodeRush - New Exception descendant (CS)

Read more…

Smart Constructor – Generating advanced type constructors in three keystrokes

April 19th, 2011 Comments off

The Smart Constructor CodeRush feature allows you to add constructors to the current class or structure, and pass type members, like fields and properties for initialization through its parameters. Creating a constructor is as simple as just typing three keys: “cc & Space”:

CodeRush Smart Constructor preview

Read more…

Code Templates – Comments

March 10th, 2011 9 comments

Here is the list of CodeRush comments-specific code templates. The templates below generate comments for code areas, tasks, and a few others (miscellaneous). Nearly all of these templates start with the “/” character (for CSharp) or ” ‘ ” (for Visual Basic). See these comments on the Editor | Templates options page in the Options Dialog.

To better understand template expansions, I recommend familiarizing yourself with a few common text commands that you can observe inside these expansions.

Read more…

Coding Helpers – Auto Declare

February 4th, 2011 Comments off

Auto Declare allows you to quickly declare a variable (field, local or parameter) based on its type. To apply Auto Declare, type the class name and press the Ctrl+A shortcut. The variable will be declared with an appropriate name, and an action hint will be shown:

CodeRush Auto Declare

Read more…

Code Templates – Region Directives

January 29th, 2011 Comments off

Here is the list of CodeRush region-specific code templates. All the templates below generate common regions. Nearly all of them start with “re”, and are followed by a few letters that describe the region to create. These templates also include the “er” template that generates an #endregion directive.

Note that to create regions for specific members, you can use the CodeRush AutoCreateRegion action (by default bound to Ctrl+3), that will create a region around the current property, method, or event automatically.

Read more…