三元运算符有一个简写,即速记三元运算符是否进行多重计算?
var = exp ?: exp2
我知道它在PHP。其他语言也可能挑选它。 C#具有类似的功能(针对此问题的上下文) - ??
。
当条件通过时,是表达式再次求值,或者在结果存储在某处?
三元运算符有一个简写,即速记三元运算符是否进行多重计算?
var = exp ?: exp2
我知道它在PHP。其他语言也可能挑选它。 C#具有类似的功能(针对此问题的上下文) - ??
。
当条件通过时,是表达式再次求值,或者在结果存储在某处?
http://msdn.microsoft.com/en-us/library/ms173224.aspx
The ?? operator is called the null-coalescing operator and is used to define a default value for nullable value types or reference types. It returns the left-hand operand if the operand is not null; otherwise it returns the right operand.
它存储,不计算两次。
等等,那么问题是什么语言? – domsson 2017-07-24 13:20:05