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:
- From the DevExpress menu, select “Options…”.
- In the tree view on the left, navigate to this folder:
Editor\Selections- Select the “Inversion” options page.
- 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
Filed under: .NET, C#, C# 2.0, C# 3.0, C# 4.0, Development, Software Development, Visual Studio 2005, Visual Studio 2008, Visual Studio 2010, Visual Studio and tools
