This is my blog about coding in C#. C# is what I do, so C# is what I am going to talk about.
Friday, November 16, 2018
Testing new syntax
A colleague used some syntax that I hadn't seen before so I thought it would be worth testing in isolation. The notation is an extension of the ternary conditional operator known as the null-conditional operator that was added as part of C# 6.0 in 2016. I believe I need to up my C# game. Anyway, here is the sample program I built:
We build our code using the null-conditional operator to avoid having to build out the more common tertiary version of the same code: