[Solved] Code smell Id = blah== null ? null : something.x ? null : something.y


In this case, another alternative to consider would be:

Id = (blah == null || something.x) ? null : something.y;

The benefit being that only one ternary is necessary (and thus null is returned from only one “branch” out of two, rather than two out of three).

solved Code smell Id = blah== null ? null : something.x ? null : something.y