I'm confused about how the null-conditional operator cascades with normal property access. Take these two examples:
a?.b.c
(a?.b).c
I would expect them to be equivalent: first, the value of a?.b
is evaluated, then result.c
is evaluated. Thus if a == null
, an exception should be thrown.
However, that only happens in the second expression. The first expression evaluates to null
, meaning it's the same as a?.b?.c
. Why?