?? Operator

by Miguel de Icaza

Today Jon pointed me to C#'s "??" operator, this is really the kind of thing that I should know. The operator is part of the nullable-type family of operators, but I did not know that you could use this with regular expressions.

Its lovely, the expression: a ?? b evaluates to a if a is not null, or to b if a is null.

Very handy, replaces the idiom: a == null ? b : a.

This is only available in the gmcs compiler.

Posted on 06 Oct 2006