Does anyone know a visual studio keyboard short cut to swap around two sides of a statement?

I think the following thread is a good place to begin with

Invert assignment direction in Visual Studio


Here's how I would go about doing that without a specific keyboard shortcut:

  • First, select the text you want to modify and replace

    " = " with "                 =               "
    

    (the key here is to add a lot of spaces).

  • If you hold down Alt and use the mouse, you can select a "block" of code. Use this to select only the text on the right side of the equation (it's helpful to add extra white space here in your selection)
  • Use the same Alt + Left-Click combination to select the beginning of the left side (just select a blank area). You should be able to paste text into here.
  • If you added extra white space to the text you just added, just should be able to easily insert an = using the Alt + Click technique. Use the same trick to remove the equal sign that's dangling on the right side of your code block.

While this might not do exactly what you're looking for, I've found these tricks quite useful.


If you're using ReSharper, you can do this by pressing CtrlAltShift + or