It’s complicated since expression tree lambdas (unlike delegate lambdas) are interpreted by already existing LINQ providers which don’t yet support null propagating.
Converting to a conditional expression is not always accurate as there are multiple evaluations while with ?.
there’s only a single evaluation for example:
customer.Where(a => c.Increment()?.Name) // Written by the user
customer.Where(a => c.Increment() == null ? null : c.Increment().Name) // Incorrectly interpreted by an old LINQ provider
You can go deeper in the relevant discussion on CodePlex where 3 solutions are offered: NullPropagationExpression
, ConditionalExpression
& a hybrid