throw
has relatively recently (in C# 7.0) been turned into an expression to enable this. return
hasn't - it is always a just statement. The ??
operator requires an expression, not a statement. It was an arbitrary choice by the C# designers, specifically to allow using throw
with ??
.
↧
Answer by dialer for Null coalescing operator (??) with return
↧