x.City == "Lahore");-6ren"> x.City == "Lahore");-这些 linq 查询有什么区别: Students.Where(x=>x.City == "Lahore").ToList(); Students.ToList().Where(x=>x.City =-6ren">
gpt4 book ai didi

c# - Students.Where(x=>x.City == "Lahore").ToList(); 之间的差异Students.ToList().Where(x=>x.City == "Lahore");

转载 作者:太空宇宙 更新时间:2023-11-03 23:13:56 28 4
gpt4 key购买 nike

这些 linq 查询有什么区别:

Students.Where(x=>x.City == "Lahore").ToList();

Students.ToList().Where(x=>x.City == "Lahore");

最佳答案

如果 Students 是可查询的:

Students.Where(x=>x.City == "Lahore").ToList();

这将对数据库进行过滤,并且:

Students.ToList().Where(x=>x.City == "Lahore");

会在内存中过滤。

关于c# - Students.Where(x=>x.City == "Lahore").ToList(); 之间的差异Students.ToList().Where(x=>x.City == "Lahore");,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37917245/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com