我很想知道为什么在 C# 7.0 中可以这样做:
int? test = 0;
int test2 = test ?? throw new Exception("Error");
但不包括这个:
int? test = 0;
int test2 = test ?? return;
有人能解释一下吗?
throw
现在是一个表达式,而return
不是(语句)。 - Caramiriel