All rules
IDE2005Language rules (new-line preferences)

Blank line not allowed after conditional expression token

Blank line not allowed after conditional expression token

Microsoft docs

Description

This style rule enforces that there should not be a blank line after the question mark (?) or colon (:) tokens in conditional (ternary) expressions. These operators should be immediately followed by their respective expressions without blank lines.

Examples

Avoid
// csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true
int result = IsTrue ?
    ComplexExpr1() :
    ComplexExpr2();
Prefer
// csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = false
int result = IsTrue
    ? ComplexExpr1()
    : ComplexExpr2();

Configurable options

Vote for the value each option should take in the generated .editorconfig.

csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental
default: true
Group results
0 yes 0 no
ConsensusNone (disabled)
Severity preference (yes voters)
Suggestion0
Warning0
Error0