I run into this problem
System.InvalidCastException: Unable to cast object of type 'System.Data.Linq.DataQuery1[Student]' to type 'System.Collections.Generic.List1[Student]'
When I debug this function:
Public Shared Function SearchStudent(ByVal firstname As String) As List(Of Student)
    Dim db As New DemoDataContext()
    Dim query = From st In db.Students _
                Where (st.FirstName.StartsWith(firstname)) _
                Select st
    Return CType(query, List(Of S开发者_运维知识库tudent))
End Function
My project property setting: Option explicit ON and Option strict ON
I want to return a List of Student from the query. Can anyone help me? Thank you.
    Dim query = (From st In db.Students _
            Where (st.FirstName.StartsWith(firstname)) _
            Select st).ToList()
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论