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>
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.