Blogs

Mark Miller

Announcing CodeRush Xpress for C#

Developer Express and Microsoft are proud to announce a new version of CodeRush licensed exclusively for C# developers working in Visual Studio. The new product is called CodeRush Xpress, and it includes a fresh selection of hand-picked features taken from CodeRush and Refactor! Pro.

Here's a sampling of what you get:

Find any File or Symbol...

Go to any file or symbol in the solution efficiently.

Quick File Navigation

Type in a few letters of the name to filter...

Quick File Navigation-call

Or hold down the shift key to filter only on uppercase letters...

Quick File Navigation-R

Uppercase characters can appear anywhere. Any uppercase characters not specified in the filter are highlighted in blue...

Quick File Navigation-RC

The uppercase letters need not be sequential. Notice how "RD" in the screen shot below matches both "ResolveDelegate.cs" and "ResolveCallbackDelegate.cs"

Quick File Navigation-RD  

Tab to Next Reference

This is a really cool navigation feature that takes you to the next (and previous) reference just by pressing the Tab key (or Shift+Tab key to go backwards) when the caret is inside an identifier, member, or a type. For example, in the following code, the caret was inside the last Person type reference (in the "new Person()" instantiation call) when the Tab key was pressed, causing the Person reference at the top of the file to become highlighted.

TabToNextReference

Expand/Shrink Selection

This feature allows you to increase a selection by logical blocks, or decrease an expanded selection by the same logical blocks. This feature is perfect when refactoring, since many refactorings work on a contiguous selection of code (e.g., extract method, introduce local, etc.).

TDD-Style Intelligent Declaration Based on Usage

Place the caret on any undeclared element in your code and press the Refactor/Code key (Ctrl+`) to see list of intelligent suggestions for the type of the new variable. For example, in the screen shot below two appropriate types are suggested, even though Console.WriteLine has many overloads that accept a wide variety of types.

DeclareLocalTwoOptions

You can even turn a function call or property access into a variable declaration.

DeclareLocalOnProperty

This makes writing code with Visual Studio's Intellisense really fast. Just use Intellisense to produce the property reference or function call, and then press the Refactor/Code key to declare a new local variable of the appropriate type. Here's an example with a function call -- notice the caret can be just about anywhere on the function call, even at the end of the line.

DeclareLocalOnFunction

You can even declare a local from a simple instantiation, like this:

DeclareLocalNewPerson

And it's worth noting you can declare all kinds of elements based on usage, not just locals. Anything you need types, members, fields -- the full list of elements that can be declared appears below.

Professional Grade Refactorings

CodeRush Xpress includes many powerful refactorings to help improve the quality of your code. For example, consider the following:

    private static void ShowInt(int n)
    {
     
Console.WriteLine(n);
    }
   
private static void ShowEntries(List<int> entries)
    {
      entries.ForEach((
Action<int>)ShowInt);
    }

With the caret on the ShowInt method reference, you can press the Refactor! key...

InlineDelegate 

and then select Inline Delegate. This will produce the following code:

    private static void ShowEntries(List<int> entries)
    {
      entries.ForEach(
delegate(int n)
                      {
                       
Console.WriteLine(n);
                      });
    }

Notice the caret is on the delegate keyword. You can immediately press the Refactor! key again...

CompressToLambdaExpression

Note that we can go in two directions now. We can either convert the anonymous method to a named method (in essence reversing the Inline Delegate refactoring we just performed), or we can take it a step further and compress the anonymous method into a lambda expression. Choosing Compress to Lambda Expression, we get the following:

    private static void ShowEntries(List<int> entries)
    {
      entries.ForEach(n =>
Console.WriteLine(n));
    }

CodeRush Xpress is loaded with powerful refactorings taken from Refactor! Pro. One of our favorites, Extract Method to Type, allows you to extract a method from one type into another, updating both the calling code and the extracted method appropriately. For an example, consider the following code:

  class Person
  {
    public string Name { get; set; }
    public bool IsAnOrphan { get; set; }
    public Person Mother { get; set; }
    public Person Father { get; set; }
  }
// ...
  class BabyMaker
  {
    public Person MakeOne(Person mother, Person father, string name)
    {
      Person newBaby = new Person();
      newBaby.Name = name;
      newBaby.Mother = mother;
      newBaby.Father = father;
      newBaby.IsAnOrphan = newBaby.Mother == null && newBaby.Father == null;
      return newBaby;
    }
  }

Notice that the code in the MakeOne method contains a local variable that's an instance of type Person, and that code sets the IsAnOrphan property. There is some logic in this method that pertains to Person, but it feels like it's in the wrong class!

We already have the class Person in our solution, so it makes sense to move some of this code to the proper class. With CoderRush Xpress installed, all we need to do is select the code we want to move....

SelectCodeToExtract 

Press the Refactor key...

 ExtractMethodToPerson3

And choose "Extract Method to Person". CodeRush Xpress analyzes the selection and determines there's at least one local variable of a type you have declared elsewhere in the solution. Now let's apply this refactoring...

 TargetPicker2

Press the Up and/or Down arrow keys to select a location for this new method, and press Enter to commit. Give the method a meaningful name...

SetParents

Cool. Now we have the logic (that should have been inside Person to start with) right where it belongs. Notice how the new SetParents instance method works on the instance itself (compare that code with the original code that operated on the newBaby local). The code is easier to read and cleaner in both locations.

Notice also that tiny dark blue triangle, in the code above. That's a stack-based marker, and CodeRush Xpress drops markers automatically whenever you apply a refactoring or TDD-style declaration that takes you away from the original location. You can jump back at any time to the top marker on the stack by pressing Escape.

There are many more refactorings and cool features in CodeRush Xpress. This is just a preview. Here's the full list of what you get:

Editor Features

  • Duplicate Line
  • Highlight Usages
  • Clipboard Features
    • Smart Cut/Copy
    • Paste Replace
  • Enhanced Selection Abilities
    • Extend/reduce selection
    • Camel-case selection

Navigation Features

  • Camel-case Navigation
  • Tab to Next Reference
  • Go to File
  • Go to Symbol (QuickNav)

TDD - Declaration from Usage

  • Types
    • Declare Class
    • Declare Delegate
    • Declare Enum
    • Declare Enum Element
    • Declare Interface
    • Declare Struct
  • Members
    • Declare Constructor
    • Declare Event Handler
    • Declare Getter
    • Declare Method
    • Declare Property
    • Declare Property (auto-implemented)
    • Declare Property (with backing field)
    • Declare Setter
  • Variables
    • Declare Field
    • Declare Local
    • Declare Local (implicit)

Refactorings

  • Add/Remove Block Delimiters
  • Combine Conditionals (merge nested "If" statements)
  • Compress to Lambda Expression
  • Compress to Ternary Expression
  • Convert to Auto-implemented Property
  • Convert to Initializer (use object/collection initialize when possible)
  • Create Backing Store (converts Auto-implemented Property to standard Property with get and set)
  • Decompose Initializer
  • Decompose Parameter
  • Expand Lambda Expression
  • Expand Ternary Expression
  • Extract Method to Type
  • Flatten Conditional
  • Introduce Local (introduce variable)
  • Inline Delegate
  • Inline Temp (inline variable)
  • Make Explicit
  • Make Implicit
  • Move Type to File
  • Name Anonymous Method
  • Name Anonymous Type
  • Reverse Conditional (invert "if")
  • Split Conditional (split complex "If" statements)
  • Use StringBuilder
  • Use String.Format
Published Oct 27 2008, 02:15 PM by
Bookmark and Share

Comments

Andrew Robinson

Mark, can I use CR Xpress along with the paid, full version of Refactor! Pro.

Hope so. Can't wait to play with this.

October 27, 2008 7:11 PM

CESAR F. QüEB

Hi,

Seems like this release has all basic features from both products...cool gift to C# developers..

but.. what 'gifts' for licensed customers?....

October 27, 2008 7:12 PM

Michael Brandt

Great news! Have I gone blind or isn't there a link to download the CodeRush Xpress for C#?

Thanks!

October 27, 2008 7:43 PM

ctodx

We've just announced a new joint venture with Microsoft: CodeRush Xpress . This is a set of navigation

October 27, 2008 9:33 PM

Peter's Software House

Cool news for those that do not have access to CodeRush and Refactor! Pro .  Developer Express and

October 27, 2008 9:41 PM

Deepak

A joint venture with Microsoft? Well done!

Looking forward to download link.

October 28, 2008 12:36 AM

.NET Geek

Fresh from the DevExpress booth at PDC comes an announcement that DevExpress will be providing a significant

October 28, 2008 12:59 AM

Hans Nieuwenhuis

I have the full, paid version of CodeRush...where can I find this Quick File Navigation window? I can't find it in the user manual nor in the options-window.

October 28, 2008 2:01 AM

Eran Nachum's Blog

October 28, 2008 8:28 AM

awake

do paying customers get any kewl stuff?

October 28, 2008 9:07 AM

Andrew Connell [MVP MOSS]

PDC 2008 - Day 1

October 28, 2008 10:06 AM

Dan

Does it work with Visual Studio Express products?

October 28, 2008 10:40 AM

Mirrored Blogs

The first real day @ PDC 2008 kicked off with the Ray Ozzie and friends keynote pimping Microsoft's

October 28, 2008 10:54 AM

Jeff

Download from here:

devexpress.com/.../CodeRushX

October 28, 2008 12:47 PM

Dennis van der Stelt

Mark Miller from DevExpress just announced CodeRush Xpress for C# developers, for free!!! In a partnership

October 28, 2008 1:55 PM

kevinpilch-bisson's WebLog

Yesterday at the PDC, Dustin announced the availability of CodeRush Xpress for C# .  This is a free

October 28, 2008 2:13 PM

CodeRush Xpress for C# | MS Tech News

Pingback from  CodeRush Xpress for C# | MS Tech News

October 28, 2008 2:25 PM

Fitness Connections

October 28th Links - SQL, Visual Studio, YUI, jQuery

October 28, 2008 3:02 PM

Nick Portelli

Neat.  Is there a way to change the highlighting colors?

October 29, 2008 4:08 PM

James C-S

I installed "CodeRush Xpress for Visual Studio" and it has killed my "Refactor! for VB". Is that right or have I done something wrong?

October 30, 2008 9:43 PM

Netbits » CodeRush Xpress

Pingback from  Netbits  » CodeRush Xpress

November 2, 2008 5:34 AM

Bart

Seems like a very nice tool but eats too much memory in my opinion (+- 100mb on new project, can go up to 200+MB on large projects). Is this normal or am is there something wrong with my machine?

November 4, 2008 11:43 AM

Emad Ibrahim

Very nice but I HATE the smart copy feature.  I like to hit ctrl c or ctrl x to copy/cut the whole line instead smart copy copies only the word.  I HATE IT and I need to turn it off.

HOW DO I TURN IT OFF?

November 4, 2008 4:26 PM

Shivani

I know there are a lot of shortcuts for CodeRush. How do I go about leaning about them? Is there a tutorial or a help file I can look at?

November 7, 2008 5:36 PM

Shivani

NM. I checked the forums and found the answer -

community.devexpress.com/.../28346.aspx

November 7, 2008 5:51 PM

Mark Miller (DevExpress)

Emad, with regard to smart cut/copy, you can still get the entire line if you place the caret at the start of the line.

November 18, 2008 9:15 PM

Kev Blaze

I have CodeRush Xpress installed, but can't find a menu option or keystroke to use the "Quick Find Navigation" feature. How do I get to it?

November 23, 2008 2:17 PM

Maciek

Mark:

I have the same question Nick Portelli does: is it possible to change default colors? I have customized my Visual Studio's editor colors (background is now almost plain black) and default colors are hardly visible...

December 6, 2008 1:55 PM

Alex W

Mark Miller - Appreciate that you can still cut/copy the whole line via that method but that's a tad slower; I'd just rather disable smart copy, is this possible?

January 6, 2009 10:54 AM

Boris

Installed it today, responsiveness has gone down.

VS2008SP1's ctrl+. functionality is gone (even after uninstall).

Hope my settings import will bring it back.

What have I done wrong? What steps should I take to get the standard VS features together with the new stuff?

March 10, 2009 5:48 AM

About Mark Miller (DevExpress)

Mark Miller is a C# MVP with strong expertise in decoupled design, plug-in architectures, and great UI. Mark is Chief Architect of the IDE Tools division at Developer Express, and is the visionary force behind productivity tools like CodeRush and Refactor!, as well as the DXCore extensibility layer for Visual Studio. Mark is a popular speaker at conferences around the world and has been writing software for over two decades.
LIVE CHAT

Chat is one of the many ways you can contact members of the DevExpress Team.
We are available Monday-Friday between 7:30am and 4:30pm Pacific Time.

If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

FOLLOW US

DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, Silverlight, ASP.NET, WinForms, HTML5 or Windows 8, DevExpress tools help you build and deliver your best in the shortest time possible.

Copyright © 1998-2014 Developer Express Inc.
All trademarks or registered trademarks are property of their respective owners