この質問を読んだ後、いくつかのことを片付ける必要があります。
IQueryable<Customer> custs = from c in db.Customers
where c.City == "<City>"
select c;
IEnumerable<Customer> custs = from c in db.Customers
where c.City == "<City>"
select c;
質問:
1) 次のように言っても問題ありません: 最初のクエリでは、SQLServer は where 句を含む操作全体を実行し、関連する行のみ をSELECT *
返し ます.
2) 単にコレクションを持っている場合はどうですか- 記憶の中に。( var lstMyPerson = new List<MyPerson>()
)
IQueryable<MyPerson> lst = from c in lstMyPerson
where c.City == "<City>"
select c;
対
IEnumerable<MyPerson> custs = from c in lstMyPerson
where c.City == "<City>"
select c;
今の実行の違いは何ですか?