C#

About a week ago, a coworker and I ran across a nifty C# operator that neither of us has seen before: the “??”.

We both know and use the ternary operator (“?”), but it took a quick look in the MSDN documentation to learn that A ?? B will return A if A is not null, B otherwise.

So instead of X = (A == null) ? B : A; we can write X = A ?? B;

That’s all for now class.