As shown in Syntax Box 8.12 the conditional operator combines three expressions with the two symbols—question mark ? and colon :. It will return either the value of ExpressionA or the value of ExpressionB, depending on whether the Boolean expression to the left of the question mark is true or false. If true, the value of ExpressionA is returned; otherwise, the value of ExpressionB is returned.
Syntax Box 8.12 The Conditional Operator
<Boolean_expression> ? <ExpressionA> : <ExpressionB>
The conditional operator is the only operator in C# to combine three expressions, so it is also referred to as the ternary operator. ...