Tech Off Post

Single Post Permalink

View Thread: The opposite of ??
  • User profile image

    I would introduce the a new variant of . operator that works with null references. Something like  .?  ex: name = Customer.?Name, or

    adrees = Customer.?Adress.?City.?Name

    The .? operator should return left side type default value when used on a null object.

    But in any case the only possible value this might add is a little sugar on the sintax expecially where there are lot's of null tests (wich happens to be the case many times when working with object hierachies and there is lot's of drilling operations done on the hierarchy).