小编典典

LINQ 查询以选择前五名

all

我有一个 LINQ 查询:

var list = from t in ctn.Items
           where t.DeliverySelection == true && t.Delivery.SentForDelivery == null
           orderby t.Delivery.SubmissionDate
           select t;

如何修改此查询以从数据库中仅选择五个结果?


阅读 72

收藏
2022-05-17

共1个答案

小编典典

var list = (from t in ctn.Items
           where t.DeliverySelection == true && t.Delivery.SentForDelivery == null
           orderby t.Delivery.SubmissionDate
           select t).Take(5);
2022-05-17