Get average value from EF
<p>I got two tables <code>Student</code> and <code>Course</code>. </p>

<p>The table <code>Course</code> uses <code>StudentId</code> as FK key. Inside <code>Course</code> table there's <code>Score</code> for each course the student have taken. </p>

<p>Now, how do I calculate the total average <code>Score</code> related to <code>StudentId</code>?</p>

<p>This is how far I got(<code>Id</code> = Students id):</p>

<pre><code>var avg = db.Courses.Where(c=&gt; c.StudentId == Id ... ?
</code></pre>

<p><strong>Edit:</strong> The <code>Course</code> table have some <code>null</code> in <code>Score</code> for unfinished cources. </p>