【发布时间】:2011-03-17 13:27:18
【问题描述】:
所以我想了解IQueryable<T>。我正在阅读的教程建议使用它,但不确定为什么。该代码仅使用 LINQ to SQL 返回一些值。我过去做过很多次,但没有使用IQueryable<T>
为什么将它与返回超过 1 个值的函数一起使用?
这是我的代码:
public IQueryable<Items> GetItems()
{
return from item in db.Items
where item.IsActive == true
orderby item.ItemNumber
select item;
}
【问题讨论】:
-
好问题。你为我节省了数小时的研究时间。
标签: c# asp.net collections data-access-layer