Meaning of safe navigation operator | Babel Free
Definitions
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.
Examples
“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.”
“The safe navigation operator (?.) provides navigation on the nested properties without getting any exception when a null value is evaluated from any of the properties iterated.”
“C# 6 introduced a cascading nulls operator, also called the null-conditional operator and the safe navigation operator.”
CEFR level
C1
Advanced
This word is part of the CEFR C1 vocabulary — advanced level.
This word is part of the CEFR C1 vocabulary — advanced level.
Know this word better than we do? Language is a living thing — help us keep it growing. Collaborate with Babel Free