Quantcast
Channel: Null coalescing operator (??) with return - Stack Overflow
Viewing all articles
Browse latest Browse all 3

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

$
0
0

Well, because no one has implemented it this way. Or, more precisely, because return is not an expression.

throw used to be a statement only prior to C# 7.0, but then was extended (due to a proposal) to be an expression as well (only expressions are supported in the null coalescing operator).

So unless no one suggests to make return an expression, it won't work.


Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>