Skip to content

Latest commit

 

History

History
61 lines (51 loc) · 1.36 KB

SA1105.md

File metadata and controls

61 lines (51 loc) · 1.36 KB

SA1105

Title Query clauses spanning multiple lines should begin on own line
TypeName SA110xQueryClauses
CheckId SA1105
Category Readability Rules

Cause

A clause within a C# query expression spans across multiple lines, and does not begin on its own line.

Rule description

A violation of this rule occurs when a query clause spans across multiple lines, but does not begin on its own line. For example:

    var elementDescriptions =
        from element in elements select GenerateElementDescription
        (
            element
        );

The query clauses can correctly be written as:

    var elementDescriptions =
        from element in elements
		select GenerateElementDescription
        (
            element
        );

How to fix violations

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

How to suppress violations

#pragma warning disable SA1105 // Query clauses spanning multiple lines should begin on own line
    var elementDescriptions =
        from element in elements select GenerateElementDescription
        (
            element
        );
#pragma warning restore SA1105 // Query clauses spanning multiple lines should begin on own line