Thursday, December 23, 2010

Null Coalescing Operator ??

For example, the myfunction whose return value may be a nullable int. In such cases, you can use the coalescing operator to quickly check if it is null and return an alternate value.

int myExpectedValueIfNull = 10;
int expectedValue = myfunction() ?? myExpectedValueIfNull

No comments: