Archive

Posts Tagged ‘Coding Helpers’

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…

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…

Specific CodeRush code providers for declaring new classes

June 1st, 2012 Comments off

CodeRush provides code providers for declaring classes, such as:

Read more…

Declare Delegate CodeRush code provider

June 1st, 2012 Comments off

A delegate is a special kind of object that holds a reference to a method. Once a delegate is assigned a method, it behaves exactly like that method. It can have parameters and a return value. Using a delegate allows the programmer to encapsulate a reference to a method inside a delegate object.

Read more…

Creating interface implementers with CodeRush

June 1st, 2012 2 comments

A class that implements an interface should implement all members of that interface. Members of implemented interfaces can be declared in two ways: implicit or explicit. That is why there are two versions of the Create Implementer code provider in CodeRush:

  • Create Implementer (implicit)
  • Create Implementer (explicit)

Read more…

Generating the Switch/Select statement for enumeration variables

April 30th, 2012 Comments off

CodeRush with Refactor! Pro provides a code provider that allows you to easily generate a switch (C#) or Select (VB) statement for all elements of the enumeration of the active identifier of the enumeration type. The Create Case Blocks from Enum code provider shows a part of the resulting code before applying it. It is possible to apply the code provider on a local variable or a parameter:

Read more…