Skip to main content
C# / .NET Code Completion Medium +20 XP

Null Conditional Operator

Complete to safely access a property.

C# / .NETFill in the blank
string name = user___Name;

Type the missing code

Show answer and explanation

Answer: ?.

The ?. (null-conditional) operator returns null instead of throwing NullReferenceException if the object is null.

Hint: Which operator short-circuits on null?

What this challenge tests

Code Completion in C# / .NET: null-safety, operators.

Related challenges