Archive

Archive for the ‘Code Generation’ Category

Creating CodeRush code templates overview

April 26th, 2012 Comments off

Creating CodeRush code templates is easy. They are being created on the Templates options page in the Options Dialog. The Templates options page is an excellent way to explore and learn how templates are built. When a template expands, and you want to see how it is built, just bring up the Template options page and the last template expanded will be displayed. I recommend maximizing the Options dialog and collapse the options tree view on the left by clicking those tiny blue rectangles that appear when you hover over the area between the tree view and options page area:

Read more…

CodeRush Templates language and learning basics

April 25th, 2012 Comments off

CodeRush code templates are easy to understand and learn. One of the easiest ways is to dock the CodeRush Training window inside the Visual Studio IDE. This window shows you the available templates for the current context. For example, if the editor caret is inside a namespace, the window will show you the following templates suggestion:

Read more…

CodeRush Code Templates overview

April 24th, 2012 Comments off

CodeRush code templates allow you to generate large code blocks on the fly with just a few keystrokes. The use of code templates dramatically decreases the code writing time, because it’s not necessary to type the entire block of code manually. The Templates library shipped with CodeRush contain lots of code templates for most code blocks and regular coding structures including regions and comments.

Read more…

Code Providers – Create Event Trigger

February 16th, 2012 2 comments

The Create Event Trigger CodeRush code provider generates an event trigger for the specified event. An event trigger is a single method that is used to raise an event. Although it is not strictly necessary to create such a trigger, it is useful, as it makes maintenance of the code simpler.

Read more…

Working with HTML tables using CodeRush

January 17th, 2012 Comments off

Generating any-size HTML tables and navigating between table cells is very easy when you have DevExpress CodeRush installed. To create a new table just type “.t” inside the HTML markup and press the Space bar. This code snippet template will execute the Table Size UI feature of CodeRush, and the following tiny window will appear:

CodeRush Table Size UI window

Read more…

Declaring fields using CodeRush consume-first declaration features

December 16th, 2011 Comments off

Unlike the local variable declarations, fields are simply variables that are declared directly within the code block of a class or a structure. Fields are declared in the type block by specifying the access level of the field, the type of the field and the name of the field. A field may also include a readonly modifier. This type of field can only have its value set directly in its declaration or from within a constructor of its containing class.

Read more…

Declaring locals using CodeRush consume-first declaration features

December 16th, 2011 Comments off

Local variable declarations are the most often used types of declarations in code. A local variable is a type of variable declared by local variable declaration inside a block the variable is intended to be local to. The local variable declaration explicitly defines the type of the variable that has been declared along with the identifier that names the variable. You can also declare implicitly typed local variables, whose type is inferred by the compiler from the expression.

Read more…

Declaring enumeration types and its elements in CodeRush

December 14th, 2011 Comments off

An enumeration type is a special set of related constants, each with an integer value. Enumerations are useful for defining states and sequences, particularly when there is a natural progression through those states. Each constant in the enumeration list can be compared and formatted using either its name or value. For example, assume that you have to define a variable whose value will represent a day of the week. There are only seven meaningful values which that variable will ever store. To define those values, you can use an enumeration type.

Read more…