Average of empty list throws InvalidOperationException: Sequence contains no elements : <p>The following code</p>

<pre><code>double avg = item?.TechnicianTasks?.Average(x =&gt; x.Rating) ?? 0
</code></pre>

<p>throws </p>

<blockquote>
  <p>InvalidOperationException: Sequence contains no elements</p>
</blockquote>

<p>the <code>item.TechnicianTasks</code> was supposed to be null, however I saw that it is an empty list, however why wouldn't the average just be zero? I'm not understanding the exception.</p>
