How to convert LINQ query result to List?

linq

Solution

No need to do so much works..

var query = from c in obj.tbCourses
        where ...
        select c;

Then you can use:

List<course> list_course= query.ToList<course>();

It works fine for me.

Problem

I need to convert linq query result to list. I tried the following code: ``` var qry = from a in obj.tbCourses select a; List<course> lst = new List<course>(); lst = qry.ToList(); ``` The following error occurred for the above code: ``` Cannot implicitly convert type System.Collections.Generic.List<Datalogiclayer.tbcourse> to System.Collections.Generic.List<course> ```

Original source

Related problems