你好我这里有一些我不明白的代码
public ObservableCollection<Packet> Items
{
get
{
this.items = this.items ?? this.LoadItems();
return this.items;
}
}
什么是 ??是什么意思?
最佳答案
??
是空合并运算符。左边的值只要不为空就返回。如果为空,则返回右边的值。
a = b ?? c;
相当于:
if (b != null)
a = b;
else
a = c;
关于C#语法??在控制语句中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7830137/