title: null reference exception with linq .where clause
body: <p>I'm trying to get a property from an array of object that can be null (the array) and I'm always getting a null reference exception.</p>
  
  <p>How can I tell LINQ to not process it in case it's null or to return an empty string?</p>
  
  <pre><code>foreach (Candidate c in candidates) {
     results.Add(new Person 
        { 
           firstName = c.firstname, //ok
           lastName = c.Name, //ok
  
           // contactItems is an array of ContactItem
           // so it can be null that's why I get null exception 
           // when it's actually null
           phone = c.address.contactItems.Where( ci =&gt; ci.contactType == ContactType.PHONE).First().contactText 
        }
     );
  }
  </code></pre>
  
  <p>I've also tried that to not take null. I don't get the mechanism to tell LINQ not to process if the array is null. </p>
  
  <pre><code>phone = c.address.contactItems.Where( ci =&gt; ci != null &amp;&amp; ci.contactType == ContactType.PHONE).First().contactText
  </code></pre>