The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,860 other subscribers

Adding a “Reverse Assignment” to CodeRush for Visual Studio .NET (via: Q35048 – DevExpress Support Center, Knowledge Base, Code Samples)

Posted by jpluimers on 2012/05/16

As a Delphi user, I’m missing the “Reverse Assignment” feature in the Visual Studio version of CodeRush.

Since CodeRush is very extendable (Mark is still explaining to people how the idea for that came from Delphi Packages back in the mid 90s), you can add this one yourself, as the a answer to this DevExpress support issue shows:

Q:

Is there a quick way to reverse the assignment in CodeRush?  For example:

FROM:
Field[“test1”] = edTest1.Value;
Field[“test2”] = edTest2.Value;

TO:
edTest1.Value = Field[“test1”];
edTest2.Value = Field[“test2”];

I know Delphi had this capability in its refactoring, does CodeRush for Visual Studio?

Thanks

Daniel Schipper


A:

Hi Dan,

Yes, it is possible. You can use the “Selection->Inversion” feature for this purpose. Please do the following:

  1. From the DevExpress menu, select “Options…”.
  2. In the tree view on the left, navigate to this folder:
    Editor\Selections
  3. Select the “Inversion” options page.
  4. Add a new “Inversion” entry, and adjust its settings as follows:
    Match With:
    %Anything1% = %Anything2%;Replacement:
    %Anything2% = %Anything1%;

After that, you can invert any assignment expression by pressing the shortcut, bound to the “SelectionInvert” command (“Ctrl + Shift + I” is used by default).

Thanks,

Vito

–jeroen

via: CodeRush for Visual Studio .NET – Q35048 – Quick way to reverse the assignment – View Issue – DevExpress Support Center, Knowledge Base, Code Samples.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.