SA1104: QueryClauseMustBeginOnNewLineWhenPreviousClauseSpansMultipleLines

StyleCop

TypeName

QueryClauseMustBeginOnNewLineWhenPreviousClauseSpansMultipleLines

CheckId

SA1104

Category

Readability Rules

Cause

A clause within a C# query expression begins on the same line as the previous clause, when the previous clause spans across multiple lines.

Rule Description

A violation of this rule occurs when a query clause spans across multiple lines, and the next clause begins on the same line as the end of the previous clause.

    object x =

        select a

        in b.GetCustomers(

            2, “x”) from c;

The query clause can correctly be written as:

    object x =

        select a

        in b.GetCustomers(

            2, “x”)

        from c;

 

How to Fix Violations

To fix a violation of this rule, move the clause down to start on the next line.