I noticed a strange behavior in Visual Studio 2010 when programming C#. When I type
var x = 2 * 5
and then enter ‘;’ VS changes the line to
var x = 2*5;
So it removes the blanks. On the other hand, if I do CTRL+X and CTRL+V in that line, the blanks are inserted again;
var x = 2 * 5;
This is quite annoying when using tools like SVN, since it makes tracking actual changes in the code more difficult. I looked at
Tools->Options->Text Editor->C#->Formatting->Spacing
but couldn’t find anything suitable. Does anybody of you know how to unify the behavior?
Thanks,
Hendrik
In the Menu:
Tools>Options>Text Editor>C#>Formatting>SpacingGo to
Set spacing for operatorsand selectInsert space before and after binary operatorsAlso in case you use extensions like ReSharper, make sure they are configured the same way as Visual Studio itself.