Quantcast
Viewing latest article 2
Browse Latest Browse All 3

Answer by dialer for Null coalescing operator (??) with return

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 ??.

See the documentation on the throw expression


Viewing latest article 2
Browse Latest Browse All 3

Trending Articles