The ?? operator is called the null-coalescing operator. It returns the left-hand operand if the operand is not null; otherwise it returns the right hand operand.
// Set y to the value of x if x is NOT null; otherwise,
// if x = null, then set y to -1.
int y = x ?? -1;
No comments:
Post a Comment