What does ?? mean in C#?
本问题已经有最佳答案,请猛点这里访问。
Possible Duplicate:
What do two question marks together mean in C#?
那是什么??在这一陈述中的意思是?
1 | int availableUnits = unitsInStock ?? 0; |
coalescing this is the null operator。它translates to:
is used to change EN可空值类型的类型"。P></
1 2 3 4 | if (unitsInStock != null) availableUnits = unitsInStock; else availableUnits = 0; |
The ?? operator returns the left-hand operand if it is not null, or else it returns the right operand.
?经营者(C #参考)?P></
availableunits variable will be the en均值= = = = 0 unitsinstock除非unitsinstock,which is availableunits空房子。P></
根据MSDN,茶?is called the空?经营者和经营者coalescing is used to define a可空值类型的默认值来作为好作为参考类型。它的左操作数返回the if it is not null手数;otherwise the right恩归来。P></
退房msdn.microsoft.com http:/ / / / / ms173224.aspx恩-美国图书馆P></