Thursday, August 25, 2011

Syntax, C#

a ? b : c;
x = x ?? 5;

Set x to b if a is true, otherwise set x to c.
x = a ? b : c;

Set x to x if x is not null, otherwise initialize x.
x = x ?? new x();