Search This Blog

Thursday, June 21, 2012

?? Operator (C# Reference)

C# > Operators > ?? Operator

The ?? operator,also called the null-coalescing operator, returns the left-hand operand if it is not null, or else it returns the right operand.

Example

// y = x, unless x is null, in which case y = 0.
int y = x ?? 0;