Walk 'object tree' with easy null handling
Looks good!I would suggest using Func instead of GetDelegate, simply because it's the same thing.Also, the compiler will deduce the type for you, so there's no need to write:Level3 level3 = NullHelper.Get(() => level1.Level2.Level3);when:var level3 = NullHelper.Get(()...
Looks good!
I would suggest using
Func<T>
instead of GetDelegate<T>
, simply because it's the same thing.
Also, the compiler will deduce the type for you, so there's no need to write:
Level3 level3 = NullHelper.Get<Level3>(() => level1.Level2.Level3);when:
var level3 = NullHelper.Get(() => level1.Level2.Level3);may be easier to read.