Skip to content

BRO1117: Comma should be on the same line as previous parameter

A comma in a parameter or argument list ends the line of the item before it. Replaces StyleCop SA1113.

Example

Before

public class Mailer
{
    public void Send(string to
        , string subject)
    {
    }
}

After

public class Mailer
{
    public void Send(string to,
        string subject)
    {
    }
}

Why

Commas at the start of a line are a habit from other languages; in C# code they stand out and break the usual layout.

How the fix works

The comma moves to the end of the item before it; the next item keeps its line and indentation.

Not reported

  • A comment next to the comma.

Compared with StyleCop

Same positions as StyleCop. StyleCop's fix gives the same result.