Skip to content

Latest commit

 

History

History
55 lines (42 loc) · 1.54 KB

File metadata and controls

55 lines (42 loc) · 1.54 KB

SA1111

TypeName SA1111ClosingParenthesisMustBeOnLineOfLastParameter
CheckId SA1111
Category Readability Rules

Cause

The closing parenthesis or bracket in a call to a C# method or indexer, or the declaration of a method or indexer, is not placed on the same line as the last parameter.

Rule description

A violation of this rule occurs when the closing bracket of a method or indexer call or declaration is not placed on the same line as the last parameter. The following examples show correct placement of the bracket:

Constructor invocations and object creation expressions, including target-typed new, are covered by this rule as well. The closing ) for these expressions should appear on the same line as the final argument when one exists.

public string JoinName(string first, string last)
{
    string name = JoinStrings(
        first, 
        last);
}

public int this[int x]
{
    get { return this.items[x]; }
}

How to fix violations

To fix a violation of this rule, ensure that the closing bracket is placed on the same line as the last parameter.

How to suppress violations

[SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1111:ClosingParenthesisMustBeOnLineOfLastParameter", Justification = "Reviewed.")]
#pragma warning disable SA1111 // ClosingParenthesisMustBeOnLineOfLastParameter
#pragma warning restore SA1111 // ClosingParenthesisMustBeOnLineOfLastParameter