Archive for the ‘Coding Helpers’ Category

Coding Helpers – Add XML Comments

August 14th, 2012 Comments off

Programming languages such as C# and Visual Basic support the creation of XML Documentation Comments, allowing developers to quickly annotate and document their source code to keep the documentation in a standard format and to gain benefit from the information as you code. Documentation is important to ensure that developers can quickly learn and use the source code.

Read more…

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 fixes for code issues for switch (select) statements

April 23rd, 2012 Comments off

You might have already learned that CodeRush suggests several code issues that highlight the switch (Select in VB) statement with hints and warnings when it has suspicious code. For example, when the switch statement handles only a subset of the possible enumeration values it is checking for, this may be a sign of incomplete code.

Until recently, there were no code fixes of those code issues. Now, they appear:

Read more…

Added two actions to repeat the last operations (refactoring or navigation)

April 19th, 2012 Comments off

There are two actions added to repeat the last operations:

  1. SmartTagExecuteLast – executes the last code or refactoring provider performed. This one is useful is you’d like to apply a specific refactoring several times in a row. The default shortcut for this action is Ctrl+Alt+Y (inspired by the Redo operation shortcut – Ctrl+Y).
  2. NavigateLast – executes the last navigation provider. Useful for navigating forward and backward using the specific navigation provider. For this action, there’s no default shortcut yet – if you have any ideas, please share them in the Comments section to this post.
Products: DXCore, CodeRush Pro
Versions: 12.1 and up
VS IDEs: 2008 and up
Updated: Apr/19/2012
ID: U012

Smart Constructor Fields/Properties Chooser dialog improvements

April 9th, 2012 Comments off
NOTE: please take into account the “Versions” field at the bottom of the post, to determine the build number for which the content is applied. Click here to see the latest officially released version.

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. To choose fields and properties that will be passed to a new constructor, the following dialog is used:

CodeRush Smart Constructor dialog

Read more…

The Create Descendant code provider availability change

March 23rd, 2012 Comments off

The Create Descendant and Create Descendant (with virtual overrides) CodeRush code providers are now available not only on the type declaration but on any reference to a type inside source code, for example:

CodeRush Create Descendant available on a reference

It allows to create derived classes without navigating to the declaration of the ancestor class.

Products: CodeRush Pro
Versions: 12.1 and up
VS IDEs: 2008 and up
Updated: Mar/24/2012
ID: U005

Changing an explicit cast-expression to an ‘as’ operator and back

February 16th, 2012 Comments off

Objects can be converted from one type to another, assuming that the types are compatible. Often this is achieved using implicit conversion or explicitly with the cast operator. To perform an explicit casting, there are two approaches used:

  • a cast-expression
  • an ‘as’ operator

Read more…