title: Best way to check for null for multi child object
body: <p>I would like to test for null to avoid exception. I receive list of objects which i have to export to excel and display in <a href="https://gridmvc.codeplex.com/" rel="nofollow">Grid.Mvc</a></p>
  
  <p><strong>Excel export:</strong></p>
  
  <pre><code>sheet.Cells["A" + i].Value = item.Car.Door.Code; //FLCo
  </code></pre>
  
  <p><strong>Grid display:</strong></p>
  
  <pre><code>columns.Add(c =&gt; c.Car.Door.Code).Titled("FLCo");
  </code></pre>
  
  <p>The thing is <strong>Car</strong> can be null, <strong>Door</strong> can be null.</p>
  
  <blockquote>
    <p>Q1: For the excel export, my solution is to use a couple of <code>if/else</code> (any
    better way)?</p>
    
    <p>For the Grid display: <code>if/else</code> or "?" operator is not supported
    inside the linq</p>
  </blockquote>
  
  <p>the following will generate error</p>
  
  <pre><code>columns.Add(c =&gt; c.Car==null?"":(c.Car.Door==null?"":c.Car.Code)).Titled("FLCo");
  </code></pre>
  
  <p><strong>error:</strong></p>
  
  <blockquote>
    <p>Cannot convert lambda expression to type
    'GridMvc.Columns.IGridColumn' because it is not a
    delegate</p>
  </blockquote>
  
  <p><strong>Q2: Any idea how to solve this?</strong></p>