A possibly-terrible alternative to conditionals full of null checks I am always super annoyed when I have to write a bunch of if statements whenever I have to traverse an object graph of possibly null objects. As there is not yet a ?. operator I resorted to creating this wonderful piece of work: TryGetProperty. Please tear it apart. This was written for LINQPad.

public bool TryGetProperty&lt;TInstance, TFinal&gt;(TInstance instance, Expression&lt;Func&lt;TInstance, TFinal&gt;&gt; propertyAccessor, out TFinal output)
{

    var currentExpression = propertyAccessor.Body as MemberExpression;
    var stack = new Stack&lt;PropertyInfo&gt;();
    do
    {
       stack.Push(currentExpression.Member as PropertyInfo);
    } while((currentExpression = currentExpression.Expression as MemberExpression) != null);

    var failed = false;

    object currentObject = instance;
    while(!failed &amp;&amp; stack.Count &gt; 0 )
    {
        currentObject = stack.Pop().GetMethod.Invoke(currentObject, null);
        failed = currentObject == null &amp;&amp; stack.Count != 0;
    }

    output = failed ? default(TFinal) : (TFinal) currentObject;
    return !failed;
}




Example call from the same file. 


void Main()
{  
    List&lt;Class1&gt; instances = new List&lt;Class1&gt; 
    {
        new Class1(),
        new Class1
        {
            Class2 = new Class2
            {
                Class3 = new Class3
                {
                    AProperty = "not null"
                }
            }
        },
        new Class1
        {
            Class2 = new Class2
            {
                Class3 = new Class3()
            }
        }
    };

    string propertyToGet;

    foreach(var instance in instances) 
    {
       if(TryGetProperty(instance, c =&gt; c.Class2.Class3.AProperty, out propertyToGet) &amp;&amp; propertyToGet != null)
       {
            "Yay!".Dump();
       }
       else
       {
            "Boo!".Dump();
       }
    }
}

public class Class1
{
    public Class2 Class2{ get; set; }
}

public class Class2
{
    public Class3 Class3 { get; set; }
}
public class Class3
{
    public string AProperty { get; set; }
}
I tend to use monads in such situations:

public static TResult With&lt;TSource, TResult&gt;(this TSource source, Func&lt;TSource, TResult&gt; action)
    where TSource : class
{
    if (source == null) return default(TResult);
    return action(source);
}

public static TSource Do&lt;TSource&gt;(this TSource source, Action&lt;TSource&gt; action)
    where TSource : class
{
    if (source != null)
    {
        action(source);
    }
    return source;
}


And then:

c.With(x =&gt; x.Class2).With(x =&gt; x.Class3).With(x =&gt; x.AProperty).Do(x =&gt; "Yay!".Dump());