DEV Community

Discussion on: Avoiding Nulls with Extension Methods

Collapse
 
entomy profile image
Patrick Kelly

?. isn't a no-op. It's an expression which returns null. Now, you've got a null expression sitting there which either needs to be discarded in the case of an intended no-op, or downstream needs to put the default value rather than the method internalizing the default value.

Is this syntactic sugar for things that can already be done? Yes. But then every language construct is syntactic sugar for things that can already be done.