空合并运算符(??):

比如int y = x ?? -1 如果x为空,那么y的值为-1.

只能是null的时候会选取第二个值。

如果需要在null和empty的时候赋值,可以用下面的方式:

string result = string.IsNullOrEmpty(m) == true ? "nihao" : m;
身是菩提树,心如明镜台,时时勤拂拭,勿使惹尘埃。
原文地址:https://www.cnblogs.com/birdofparadise/p/7107525.html