I recently found that we can use ?? operator to check nulls. Please check the below code samples:
var res = data ?? new data();
This is
One reason (as others have already touched) is likely to be lack of awareness. It could also be (as in my own case), a wish to keep the number of approaches to do similar things in a code base down as much as possible. So I tend to use the ternary operator for all compact if-a-condition-is-met-do-this-otherwise-do-that situations.
For instance, I find the following two statements rather similar on a conceptual level:
return a == null ? string.Empty : a;
return a > 0 ? a : 0;