It returns the left-hand operand if it is not null; otherwise it returns the right operand
int? x = null;
// y = x, unless x is null, in which case y = -1.
int y = x ?? -1
// In here y = -1
x = 1;
y = x ?? -1
// In here y = 1
Reference:
No comments:
Post a Comment