title: Linq sum and null
body: <p>I have the query:</p>
  
  <pre><code>var qq = (from c in db.tblArcadeGames
          where
              c.IsDeleted == false &amp;&amp;
              c.ParentGameID == 0 &amp;&amp;
              c.Approved == true
          let aggPlays = c.Plays + db.tblArcadeGames.Where(v =&gt; v.ParentGameID == c.ID).Sum(v =&gt; (int?)v.Plays)
          orderby aggPlays descending
          select new { c, aggPlays })
          .Skip(Skip)
          .Take(Fetch);
  
  foreach (var g in qq)
  {
      HttpContext.Current.Response.Write("{" + g.aggPlays + "}\n");
  }
  </code></pre>
  
  <p>When I print out <code>aggPlays</code> in the loop above they come out as:</p>
  
  <pre><code>{21}
  {}
  {}
  {}
  </code></pre>
  
  <p>The problem seems to be that the <code>Sum()</code> returns <code>null</code> if no records exist.  I'm not sure how to get around this so that <code>c.Plays + null</code> wont equal <code>null</code> but just <code>c.Plays</code>.</p>