Execution order of conditions in C# If statement

后端 未结 8 1967
孤城傲影
孤城傲影 2020-12-08 19:32

There are two if statements below that have multiple conditions using logical operators. Logically both are same but the order of check differs. The first one works and the

8条回答
  •  -上瘾入骨i
    2020-12-08 19:57

    The conditional-AND operator (&&) performs a logical-AND of its bool operands, but only evaluates its second operand if necessary.

提交回复
热议问题