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 generic type constraints onto a new line #527

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

Consider always putting generic type constraints onto a new line #527

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

Comments

@belav
Copy link
Owner

belav commented Dec 21, 2021

According to this stylecop rule generic type constraints should always be on a new line.

I think I am on board with modifying this

    public static T CreatePipelineResult<T>(
        T result,
        ResultCode resultCode,
        SubCode subCode,
        string message = null
    ) where T : PipeResultBase
    {
// vs
    public static T CreatePipelineResult<T>(
        T result,
        ResultCode resultCode,
        SubCode subCode,
        string message = null
    ) 
        where T : PipeResultBase
    {

But it makes less sense in cases like this

    public int Foo<T>(T obj) where T : U;
// vs
    public int Foo<T>(T obj) 
        where T : U;

From the files in csharpier-repos, only 39% of generic type constraints are on a new line. But that doesn't take into account super short examples vs long ones.

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