Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable automatic line break on base constructor call

My classes are formatted like this automatically in Visual Studio.

[Serializable]
public class TestException : Exception {
    public TestException()
        : base() {
    }
}

I do not want that line break to happen between constructor and base constructor call, so it should look like this.

[Serializable]
public class TestException : Exception {
    public TestException() : base() {
    }
}

What settings would I have to change in order to achieve my expected result?

like image 802
dwonisch Avatar asked May 14 '13 18:05

dwonisch


1 Answers

Unfortunately there is no such setting in the Visual Studio's built-in Options\Text Editor\C#\Formatting\New Lines dialog.

If you use ReSharper there is a Place constructor initializer on same line option under Code Editing\C#\Formatting Style\Line Breaks and Wrapping:

ReSharper

like image 119
m0sa Avatar answered Oct 17 '22 00:10

m0sa