Public Function GetSubjectList(ci As CultureInfo, EACode As String) As IEnumerable(Of SelectListItem)
Dim items
Dim innerQuery = (From c In _context.TblSchoolDatas
Where c.EACODE = EACode And c.AnalystedStudents >= 10
Select (c.SubjectID)).Distinct()
items = From s In _context.TblSubjects
Where innerQuery.Contains(s.SubjectID)
Order By s.Ordering
Select New SelectListItem With {.Text = s.ShortNameE, .Value = s.SubjectID}
**items.Insert(0, New SelectListItem() With {.Text = "All", .Value = "All"})**
Return items
End Function
找不到类型'DbQuery(Of SelectListItem)'上的公共成员'插入'。 错误以粗体显示,谢谢
还有一个调试屏幕,供您参考
答案 0 :(得分:1)
您正在尝试插入LINQ表达式。试试
items.ToList();
之前
items.Insert()