[英]How to stop Visual Studio from auto formatting certain parts of code?
This seems like it should be really simple to do but I just can't figure it out.这看起来应该很简单,但我就是想不通。 I want to allow Visual Studio to keep auto formatting my code as it is, except for this part:我想让 Visual Studio 保持自动格式化我的代码,除了这部分:
public SomeClass : BaseClass {
public SomeClass()
: base()
{
}
}
Why can't I have it look like this instead:为什么我不能让它看起来像这样:
public SomeClass : BaseClass {
public SomeClass() : base() {
}
}
I looked through Tools -> Options -> Text Editor -> C# -> New Lines and can't find it.我查看了工具 -> 选项 -> 文本编辑器 -> C# -> 新行并找不到它。 Is there a way I can change it to allow auto formatting and my second example?有没有办法可以更改它以允许自动格式化和我的第二个示例?
AFAIK 没有办法阻止 Visual Studio 这样做。
Are you sure that unchecking:你确定取消选中:
Options -> Text Editor -> C# -> Formatting -> New Lines -> Place Open Brace on new line for types Options -> Text Editor -> C# -> Formatting -> New Lines -> Place Open Brace on new line for types
doesn't do what you want?不做你想做的事?
and also uncheck并取消选中
Place open brace on newline for methods.在方法的换行符上放置左大括号。
(nvrmind.. I see what you are getting at... It is annoying) (nvrmind ..我明白你在说什么......这很烦人)
您购买ReSharper并将其用于所有格式设置,您可以完全按照您想要的方式进行设置 =)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.