Note that you can use any number of these in sequence. The following statement will assign the first non-null Answer# to Answer (if all Answers are null then the Answer is null):string Answer = Answer1 ?? Answer2 ?? Answer3 ?? Answer4;另外值得一提的是,虽然上面的扩展在概念上是等价的,但每个表达式的结果只计算一次.例如,如果表达式是具有副作用的方法调用,则这一点很重要.(感谢@Joey 指出这一点.)Also it's worth mentioning while the expansion above is conceptually equivalent, the result of each expression is only evaluated once. This is important if for example an expression is a method call with side effects. (Credit to @Joey for pointing this out.) 这篇关于C#中两个问号放在一起是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 09-05 06:24