Double question mark operator in C#…

12 09 2010

Here is just a very quick overview of the double question mark operator (or ??) in C#. More information can be found here.

This operator simply means that if anything to the left is NOT NULL – use it, else move to the next untill you find a vaule that is not null. I.E.

int? k = null;
int? j = null;
int? s = 7;

return (k ?? j ?? s);

Simple as that!
Happy coding!