Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider always putting constructor initializers on their own line #526

Closed
belav opened this issue Dec 21, 2021 · 0 comments · Fixed by #782
Closed

Consider always putting constructor initializers on their own line #526

belav opened this issue Dec 21, 2021 · 0 comments · Fixed by #782

Comments

@belav
Copy link
Owner

belav commented Dec 21, 2021

According to this stylecop rule constructor initializers should always be on their own line.

This probably helps in a case like this

public class RealTimeCallTimeoutException
{
    public RealTimeCallTimeoutException(string call) : base(call + " timed out") { }

    public RealTimeCallTimeoutException(string call)
        : base(call + " timed out") { }
}

But feels a bit silly in a case like this

public class GenInt
{
    public GenInt() : base(1) { }

    public GenInt()
        : base(1) { }
}

Running the numbers on the csharpier-repos code, 67% of initializers are on a new line. But that doesn't take into account how long the constructor or initializer are.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant