title: how to validate if lambda query returns null
body: <p>I retrieve data from database with lambda like</p>
  
  <pre><code> var obj = DBContext.MyTable.Where(x =&gt; x.ID == 2).SingleOrDefault().MyColumn;
  </code></pre>
  
  <p>Actually , in <code>MyTable</code> , there is no ID with 2 .<br>
  So I got this message .</p>
  
  <blockquote>
    <p>Object reference not set to an instance of an object.</p>
  </blockquote>
  
  <p>How can I validate it properly ?</p>