please tell me What is difference between ToList() & AsQueryable() ?
see the code with AsQueryable()
- var source = (from customer in _context.CustomerTBs.
- OrderBy(a => a.Country)
- select customer).AsQueryable();
- var source = (from customer in _context.CustomerTBs.
- OrderBy(a => a.Country)
- select customer).ToList();
looking for answer in details. thanks
Brajesh KumarPosted Mar 15, 2018, 8:54 AM
Brajesh KumarPosted Mar 16, 2018, 10:58 PM
Tridip BhattacharjeePosted Mar 16, 2018, 3:40 AM
first line
-------------
var ctx = new SchoolDBEntities()
var student = (from s in ctx.Students
where s.departmentid == 10
select s).ToList();
suppose later if i add more condition like
second line
-------------
student = student.Where(s => s.StudentName == "Jeff");
so tell me what will happen when 2nd line will execute. again a new db trip will occur or filter will occur on whatever data will comes from the first query ?
Nanddeep NachanPosted Mar 15, 2018, 8:33 AM
Sagar Pandurang KapPosted Mar 15, 2018, 3:38 AM