Click here to Skip to main content
13,095,445 members (61,077 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

2.1K views
1 bookmarked
Posted 7 Dec 2010

Walk 'object tree' with easy null handling

, 19 Dec 2010
Rate this:
Please Sign up or sign in to vote.
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.

License

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

Share

About the Author

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

You may also be interested in...

Pro
Pro

Comments and Discussions

 
-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170813.1 | Last Updated 19 Dec 2010
Article Copyright 2010 by IGood
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid