safe navigation operator
名词 n.
英文释义
名词 n.
-
A binary operator that returns its second argument, unless the first argument is null, in which case it returns null; used to simplify code that would otherwise need multiple explicit checks for nullity.
— One operator I haven't talked about yet is the safe navigation operator (?.). By preceding a dot with a question mark, you can safely navigate to methods or properties of an object even if that object is null.
0 次浏览
数据来源: Wiktionary