Will ListEqualByComparer.TryGetOrCreate
always be called before EnumerableEqualByComparer.TryGetOrCreate
?
Yes, and as ||
is short-circuiting, the second call will only be made if the first call returns false
.
From the C# 5 specification, section 7.12.1:
When the operands of &&
or ||
are of type bool
, or when the operands are of types that do not define an applicable operator &
or operator |
, but do define implicit conversions to bool
, the operation is processed as follows:
[...]
The operation x || y
is evaluated as x ? true : y
. In other words, x
is first evaluated and converted to type bool
. Then, if x
is true, the result of the operation is true
. Otherwise, y
is evaluated and converted to type bool
, and this becomes the result of the operation.