Reputation: 5166
I wonder whether code like this should execute GetAnotherValue()
?
int? x1 = null;
var check = x1 <= GetAnotherValue();
I assume it shouldn't since that sounds more reasonable to me. But I'm not sure if this is guaranteed. As far as I can find, the specification doesn't say anything about this.
EDIT:
I found some more specification docs on the topic of expressions. It still isn't clear though.
It seems like lifted operators convert both operands to nullable equivalents, then check for nulls and call the original operators if needed.
This would imply my GetAnotherValue()
method would get executed, to produce the second int?
value for the lifted comparison. Am I correct with this interpretation?
Upvotes: 1
Views: 95