title: Is there a way to have a default when a sequence contains no elements when using .first with LINQ?
body: <p>I am using the following code:</p>
  
  <pre><code>public class BtnCountViews
  {
      public int btnCount { get; set; }
      public int views { get; set; }
  }
  
  var btns = "(BTNACOUNT + BTNBCOUNT) AS BtnCount, VIEWS As Views";
  Counts.btnCountViewsToday = 
     db2.Query&lt;BtnCountViews&gt;("SELECT " + btns + " FROM CLICKHISTORY WHERE YYMMDD = " + yymmdd).First();
  </code></pre>
  
  <p>When there is no record returned for the day yymmdd then this errors out with a message saying <code>sequence contains no elements</code>. </p>
  
  <p>I do understand why this is happening but would like some suggestions on how I could stop it throwing an exception. </p>
  
  <p>What I would like to do if there are no elements is for Counts.btnCountViewsToday to contain an object populated with a 0 in the btnCount and the views fields.</p>