问题
I'm trying to align some assignments to improve readability, but each time I paste something, Visual Studio 2013 automatically removes the extra spaces before the =
.
For example, this:
static class Constants {
public static string Something = "A value";
public static string SomethingElse = "Another value";
}
gets re-formatted like this:
static class Constants {
public static string Something = "A value";
public static string SomethingElse = "Another value";
}
Is there a way to turn this off?
回答1:
This can be turned off in Tools->Options->Text Editor->C#->Formatting->Spacing
via the "Ignore spaces in declaration statements" option.

回答2:
VB.net for VisualStudio 2016 instructions:
|<-- main menu bar -->|<------------Side Panel Of Options Window------>|
Tools --> Options --> | Text Editor v | --> | Basic v | --> | Advanced |
Options.Advanced window:
=========================================================
= +----Highlighting-------------------------------+ =
= | (...) | =
= +-----------------------------------------------+ =
= =
= +----Outlining----------------------------------+ =
= | (...) | =
= +-----------------------------------------------+ =
= =
= +----Editor Help--------------------------------+ =
= | | =
= | [ ] Pretty listing (reformatting) of code | =
= | | =
= +-----------------------------------------------+ =
=========================================================
Screen shot:
来源:https://stackoverflow.com/questions/28834688/stop-visual-studio-2013-from-automatically-removing-extra-spaces-in-assignments