Ste*_*uiz 3 c# null if-statement null-coalescing-operator
有更简单的方法吗?
string s = i["property"] != null ? "none" : i["property"].ToString();
注意它和null-coalesce(??)之间的区别是在返回之前访问not-null值(op的第一个操作数).
Jar*_*Par 6
请尝试以下方法
string s = (i["property"] ?? "none").ToString();
归档时间:
14 年,11 月 前
查看次数:
205 次
最近记录: