Tools to Swap Equations in Code
ReSharper 4.5 supports this; select the lines, hit Alt+Enter, and choose Reverse assignments.
Found this too: another example, and explanation on how to install it:
http://www.switchonthecode.com/tutorials/how-to-configure-and-use-visual-studio-macros
You could use Visual Studio Find & Replace to perform the swap. Here's a regular expression pair that will perform the replacement automatically:
Find: ^{:b*}{([^=]+)} += +{([^=]+)};
Replace: \1\3 = \2;
Remember to turn on regular expressions. This will do exactly what you are asking for. This can also be encapsulated into a macro. Here's an example Macro that I put together:
Sub SwapAssignments()
DTE.Find.Action = vsFindAction.vsFindActionReplaceAll
DTE.Find.FindWhat = "^{:b*}{([^=]+)} += +{([^=]+)};"
DTE.Find.ReplaceWith = "\1\3 = \2;"
DTE.Find.Target = vsFindTarget.vsFindTargetCurrentDocumentFunction
DTE.Find.MatchCase = False
DTE.Find.MatchWholeWord = False
DTE.Find.MatchInHiddenText = True
DTE.Find.PatternSyntax = vsFindPatternSyntax.vsFindPatternSyntaxRegExpr
DTE.Find.ResultsLocation = vsFindResultsLocation.vsFindResultsNone
If (DTE.Find.Execute() = vsFindResult.vsFindResultNotFound) Then
Throw New System.Exception("vsFindResultNotFound")
End If
DTE.Windows.Item("{CF2DDC32-8CAD-11D2-9302-005345000000}").Close()
End Sub
...This will simply swap assignments in the current block.