I need to convert linq query result to list. I tried the following code:
var qry = from a in obj.tbCourses
You need to use the select new LINQ keyword to explicitly convert your tbcourseentity into the custom type course. Example of select new:
var q = from o in db.Orders
where o.Products.ProductName.StartsWith("Asset") &&
o.PaymentApproved == true
select new { name = o.Contacts.FirstName + " " +
o.Contacts.LastName,
product = o.Products.ProductName,
version = o.Products.Version +
(o.Products.SubVersion * 0.1)
};
http://www.hookedonlinq.com/LINQtoSQL5MinuteOverview.ashx