我正在使用 asp.net MVC2,并且在以下代码行中出现错误
<% double RunningTotal = 0; %>
<%foreach (var item in Model)
{%>
<%var allowedHours = item.tblPerson.tblPersonAllowedHours.Where(x=>x.Semester == item.Semester).Sum(x=>x.AllowedHoursPerWeek); %>
<tr>
<td><%: item.Semester %></td>
<td><%: allowedHours.ToString() %></td>
<td><%: item.tblPerson.tblCourseWantedHours.Where(x => x.Semester == item.Semester).Sum(x => x.WantedHoursPerWeek+x.UL+x.UT) %></td>
<td><%: item.tblPerson.tblCourseWantedHours.Where(x => x.Semester == item.Semester).Sum(x => x.WantedHoursPerWeek+x.UL+x.UT) - allowedHours %></td>
<%: RunningTotal += (item.tblPerson.tblCourseWantedHours.Where(x => x.Semester == item.Semester).Sum(x => x.WantedHoursPerWeek + x.UL + x.UT) - allowedHours) %>
<td></td>
我得到的错误就在这条线上
<%: RunningTotal += (item.tblPerson.tblCourseWantedHours.Where(x => x.Semester == item.Semester).Sum(x => x.WantedHoursPerWeek + x.UL + x.UT) - allowedHours) %>
错误描述是
CS0266: Cannot implicitly convert type 'double?' to 'double'. An explicit conversion exists (are you missing a cast?)
知道我在这里缺少什么吗?