Execution order of conditions in C# If statement

The && and || operators short-circuit. That is:

1) If && evaluates its first operand as false, it does not evaluate its second operand.

2) If || evaluates its first operand as true, it does not evaluate its second operand.

This lets you do null check && do something with object, as if it is not null the second operand is not evaluated.

Leave a Comment