我使用Enumerable.ToDictionary創建一個字典掀起了LINQ呼叫:Enumerable.ToDictionary僅檢索它需要的內容嗎?
return (from term in dataContext.Terms
where term.Name.StartsWith(text)
select term).ToDictionary(t => t.TermID, t => t.Name);
將這一號召取每學期的全部,還是會只從我的數據檢索TermID和名稱字段供應商?換句話說,我會被保存自己的數據庫流量,如果我寫的,而不是像這樣:
return (from term in dataContext.Terms
where term.Name.StartsWith(text)
select new { term.TermID, term.Name }).ToDictionary(t => t.TermID, t => t.Name);