?? 运算符定义在将可以为 null 的类型分配给非可以为 null 的类型时返回的默认值。
int? c = null; // d = c, unless c is null, in which case d = -1. int d = c ?? -1;
此运算符还可用于多个可以为 null 的类型。例如:
int? e = null; int? f = null; // g = e or f, unless e and f are both null, in which case g = -1. int g = e ?? f ?? -1;