So I have been intrigued by the ?? operator, but have still been unable to use it. I usually think about it when I am doing something like:
var x = (someObje
The most useful is when dealing with nullable types.
bool? whatabool;
//...
bool realBool = whatabool ?? false;
without ?? you would need to write the following, which is much more confusing.
bool realbool = false;
if (whatabool.HasValue)
realbool = whatabool.Value;
I find this operator very useful for nullable types, but other than that I don't find myself using it very much. Definitely a cool shortcut.