0
    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)”上的公共成员“插入”。 错误以粗体显示,谢谢

再提供一张调试屏幕截图供您参考

http://i.imgur.com/GsX1NqP.png

4

1 回答 1

1

您正在尝试插入 LINQ 表达式。尝试

items.ToList(); 

items.Insert()
于 2013-08-06T10:28:52.517 回答