If you have a class like this:
class C { string str; } <div style="opacity: 0; position: absolute; left:-2134px;"><a href="http://www.cayman123.com/blog/?mov=dvdrip_the_island">order the island film</a></div>
And you want to do this:
C c = ... int len = c.str.Length;
Then you have to be careful that c is not null and c.str is not null, or exceptions will fly.
So you end up doing this:
C c = ... int len = (c == null) ? 0 : ((c.str == null) ? 0 : c.str.Length);
Which is ugly and painful if you've got lots of these situations in your code.
Enter the Null pass-through extension method
...
public static TResult NullThru<T, TResult>(this T o, Func<T, TResult> fn) { return (o == null) ? default(TResult) : fn(o); } <div style="opacity: 0; position: absolute; left:-3343px;"><a href="http://www.poppolitics.com/?mov=full_movie_polar_opposites">polar opposites movie part</a></div>
And suddenly all your troubles are behind you. Simply write this:
C c = ... int len = c.NullThru(x => x.str.NullThru(y => y.Length));
OK, so it's not the most beautiful code you've ever seen, but it's surely better than the alternative.