In past versions of Visual Studio, I could create a single-line autoproperty in C# like this:
public int Whatever { get; set; }
If I hit Control-K, Control-D to format, the property would stay that way.
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) { }
Now Visual Studio 2015 insists on doing this:
public Whatever(int stuff) : base(stuff) { }
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.)
(Why even care? Because when I use the Collapse to Definitions outlining command, single-line properties and constructors stay as they are, whereas wrapped ones collapse. If they're collapsed, I can't tell at a glance that they're empty; I have to toggle them to uncollapsed just to see that nothing's there.)
The C programming language is so popular because it is known as the mother of all programming languages. This language is widely flexible to use memory management. C is the best option for system level programming language.
In 1978, Brian Kernighan and Dennis Ritchie published the first edition of The C Programming Language.
The Beginning The C programming language came out of Bell Labs in the early 1970s. According to the Bell Labs paper The Development of the C Language by Dennis Ritchie, “The C programming language was devised in the early 1970s as a system implementation language for the nascent Unix operating system.
The Pascal method is arguably faster, because no interpretation takes place, but the C method is highly extensible.
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"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With