Click here to Skip to main content
Click here to Skip to main content

Walk 'object tree' with easy null handling

By , 19 Dec 2010
 
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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

IGood
Software Developer 5TH Cell
United States United States
Member
Tools & gameplay programmer at 5TH Cell Media.
DigiPen student class of '09.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
-- There are no messages in this forum --
Permalink | Advertise | Privacy | Mobile
Web04 | 2.6.130516.1 | Last Updated 19 Dec 2010
Article Copyright 2010 by IGood
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid