It could be called IfNotNull or Maybe, currently i'm going with Maybe.
Project available at http://Maybe.codeplex.com
So we've all had to write code like
if(one==null) return null;
if(one.two==null) return null;
if(one.two.three==null) return null;
Now there's code to do it all in one fell swoop.
It also handles primitives not just classes:
return one.MaybeNullable(o=>o.two.three, t=>t.four);
Some reading on the subject:
Note to self: Answer this once posted: http://stackoverflow.com/questions/854591/how-to-check-for-nulls-in-a-deep-lambda-expression/854619#854619
Excessive explanation, part twenty
4 days ago