难道C#格式化在Visual Studio 2015年的变化?我怎么能改回来? [英] Did C# formatting change in Visual Studio 2015? And how can I change it back?
问题描述
在Visual Studio以前的版本,我可以创建在C#这样的单行autoproperty:
In past versions of Visual Studio, I could create a single-line autoproperty in C# like this:
public int Whatever { get; set; }
如果我打控制-K,Ctrl-D组合格式时,属性将保持下去。
If I hit Control-K, Control-D to format, the property would stay that way.
不过,在Visual Studio 2015年RC,当我输入属性,它包装,即使我解开它,格式化重新包装它:
But in Visual Studio 2015 RC, when I type the property, it wraps, and even if I unwrap it, formatting wraps it again:
public int Whatever
{ get; set; }
我和构造注意到它。在过去,(只是称为基类的构造如)一个空的构造可能是这样的:
I've noticed it with constructors as well. In the past, an empty constructor (e.g. that just called a base class constructor) could look like this:
public Whatever(int stuff)
: base(stuff) { }
现在的Visual Studio 2015年坚持这样做
Now Visual Studio 2015 insists on doing this:
public Whatever(int stuff)
: base(stuff)
{ }
有其他人注意到了这一点?这是在Visual Studio 2015年做出了改变?如果是这样,是有办法,我可以改回来?我通过工具>选项的C#格式化部分看,也没有找到可能影响这个任何新的设置。
Have others noticed this? Is this a change made in Visual Studio 2015? If so, is there a way I can change it back? I looked through the C# formatting section of Tools > Options, but couldn't find any new setting that might affect this.
(这不是不可能的,我的添加 - 之一插件是导致它,但我没有发现任何明显的罪魁祸首。)
(It's not impossible that one of my add-ins is causing it, but I didn't find any obvious culprits.)
的(为什么连照顾?因为当我使用折叠来定义,概述命令,单行特性和构造保持原样,而那些缠崩如果他们昏倒,我不能一眼就看出他们是空的告诉;我要切换他们未折叠只是看到什么都没有。 )的
推荐答案
转到工具>选项>文本编辑器> C#>格式>包装
Go to Tools > Options > Text editor > C# > Formatting > Wrapping
检查的一行离开块和发表声明和成员声明在同一行
Check "Leave block on single line" and "Leave statements and member declarations on the same line"
这篇关于难道C#格式化在Visual Studio 2015年的变化?我怎么能改回来?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!