title: IF statement is not working as expected
body: <p>My <code>IF</code> statement is not working as expected and it's bugging me big time. I'm not sure to what I'm doing wrong. Could someone please shed some light on this?</p>
  
  <pre><code>var _getData = db.EventTable.Where(x =&gt; x.EventID == id &amp;&amp; x.Town == town).ToList();
  
  if (_getData != null)
  {
      foreach (var e in _getData)
      { 
           // some logic here to update the event etc
      }                          
  }
  else
  {
      // some logic to create an event
  }
  </code></pre>
  
  <p>My code never hits the <code>else</code> block when the <code>_getData</code> is null, I don't know why this is. I need it to hit the else block in order to create an event in the database.</p>
  
  <p>What am I doing wrong?</p>
  
  <p>Thank you</p>