Archive for the ‘CodeRush’ Category

Quick ways to add and remove a set/get property accessor with CodeRush

August 9th, 2012 Comments off

A property without a ‘set’ accessor is considered read-only:

CodeRush Add Setter code sample

Read more…

Coding Helpers – Reverse For Loop

August 9th, 2012 Comments off

When working with arrays and lists enumerating all of its items we usually create a for loop statement as follows:

CodeRush Reverse For Loop code sample

Read more…

Code Issues specific to declaring types

August 9th, 2012 Comments off

The CSharp and Visual Basic programming language specifications have several restrictions on how type elements such as a class, structure, and delegate are declared in the code. Let’s review code issues that demonstrate an incorrect type declaration, and see the error before the compiler informs us about it when we build the code.

Read more…

CodeRush INotifyPropertyChanged interface support

July 31st, 2012 2 comments

Since ancient times, CodeRush has supported the INotifyPropertyChanged interface implementation. The interface provides a standard way to notify binding clients of a property value change. It has just one event, with a simple and clear name, PropertyChanged.

The most important part of the support of this interface is connected to the code templates. Once you expand a property template in a class that implements the INotifyPropertyChanged interface, you will see the corresponding code generated. For instance, expanding the ‘ps’ template will produce the following code:

Read more…

The support of multi-selection for Visual Studio by CodeRush

July 27th, 2012 Comments off

The Visual Studio IDE has a great box selection feature that allows you to select a rectangular region of text within the code editor by holding down the Alt key while selecting the text region with the mouse:

Visual Studio box selection

Read more…

Unit Testing Service configuration and options

July 24th, 2012 Comments off

The Unit Test Runner has two dedicated option pages in the Options Dialog. The first one is called Test Runner inside the Unit Testing category. It provides you with the capability to tweak the system settings of the Unit Testing Service as well as required paths to the testing frameworks. The second option page named Test Runner Window allows you to configure the Test Runner tool window, its behavior and visual appearance preferences. Let’s take a closer look at both options pages.

Read more…

CodeRush code generation features for declaring types

June 1st, 2012 Comments off

The following code declaration features are available in CodeRush for generating new type declarations (in alphabetical order). Click on the name to learn more about a specific code provider.

Create Ancestor

Creates an ancestor class for an active type. Active type becomes a descendant of the created ancestor class.

Create Descendant

Creates a descendant class providing overrides for abstract members.

Read more…

Declare Attribute CodeRush code provider

June 1st, 2012 2 comments

Attributes provide a powerful method of associating declarative information by decorating elements of the code, such as types, methods, properties, parameters and assemblies. Once an attribute is associated with a program entity, it can be queried at run time and used in various cases, for example, associating a help document with program entities (via the Help attribute), or marking an item as out of date (via the Obsolete attribute).

Read more…