What does a double question mark do in C#?
This is a null coalescing operator. The method above states x is assigned y's value, unless y is null, in which case it is assigned z's value.
Use y
if not null
, otherwise use z
.
From Wikipedia:
It's the null-coalesce operator and shorthand for this:
x = (y != null ? y : z);