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

Null coalescing operator (??) with return

$
0
0

I was wondering why it is possible to do this in C# 7.0:

int? test = 0;int test2 = test ?? throw new Exception("Error");

..but not this:

int? test = 0;int test2 = test ?? return;

Can someone explain that?


Viewing all articles
Browse latest Browse all 3

Trending Articles



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