Archive for the ‘CodeRush’ Category

Organizing source code and sorting class members using CodeRush

April 14th, 2011 2 comments

Reorganization of the code is a great practice to improve code readability. If you prefer to sort your type members like this:

class {
private fields
public properties
public methods
private methods

or any other order, you can use the Member Organizer CodeRush plug-in for this purpose.

Read more…

Differences between CodeRush Pro and CodeRush Xpress

April 1st, 2011 Comments off

Let’s compare the feature sets of the free CodeRush Xpress version and full CodeRush Pro version bundled with Refactor! Pro. Remember, that CodeRush Xpress is completely free to all Visual Studio 2008 and 2010 C# and Visual Basic developers. Its features are listed on the appropriate page.

The table below is almost a full list of features these two products provide. The comparison is made in the following areas:

Read more…

Code Issues – Environment.NewLine can be used

March 19th, 2011 Comments off


When working with strings that contain multiple lines of text, you have to add newline characters to your strings, so each line is separated with a line break. Line breaks are often added by inserting a carriage return line feed escape characters. This can cause cross-platform compatibility issues, because your code might end up being compiled under Mono in Unix, for example.

The “Environment.NewLine can be usedCodeRush code issue shows a suggestion to convert escape characters (“\r\n“) inside your code into the constant value defined in .NET Framework. Changing these strings to the Environment.NewLine constant will, firstly, improve the code clarity, so you don’t have to use escape characters, and, secondly, fix potential platforms portability issues – so, you don’t have to be concerned about such problems.

Read more…

Code Issues – Redundant else statement

March 19th, 2011 Comments off


The else statement is redundant when it doesn’t contain any code, and can be safely removed to improve readability. The type of code issue is a dead code.


CodeRush Redundant 'else' statement

How to fix:

CodeRush Redundant Else Statement Fix

Products: CodeRush Pro
Versions: 12.1 and up
VS IDEs: any
Updated: Nov/12/2012
ID: C084

CodeRush Pro clipboard tools overview

March 14th, 2011 Comments off

CodeRush Pro includes several intelligent clipboard tools:

Smart Copy and Smart Cut

These clipboard features allow you to take an identifier or a block of code, and put it into clipboard without selecting it in advance. Just place the editor text caret at the identifier or at the start or end of a code block and press the copy key (Ctrl+C or Ctrl+Insert) or the cut key (Ctrl+X or Shift+Delete). This makes it easy to use cut and copy operations to move, duplicate or delete contiguous blocks of code, like methods, properties, conditional statements, loops, try/catch/finally blocks, comments, etc without selecting it first.

Read more…

Options – Intelligent Paste

March 14th, 2011 Comments off

There are two options pages for the Intelligent Paste CodeRush clipboard feature inside IDETools Options Dialog. The first one defines the main expansions and the second one allows you to manage Intelligent Paste extensions. Note the difference between “expansions” and “extensions”; in other words, extensions provide expansions. For example, the “Regular Expressions” extension provides the main list of Intelligent Paste expansions from the first options page:

CodeRush Intelligent Paste options page

Read more…

Clipboard Tools – Intelligent Paste

March 14th, 2011 Comments off

The CodeRush Intelligent Paste clipboard feature modifies the text from the clipboard before inserting it into the code editor. An action hint with the name of the expansion appears once the suitable expansion is triggered on the Paste (Ctrl+V) command.

For example, copying a field member into a clipboard and then pasting it on the next line will produce a read-write property for the field:


private int myValue;

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…