LINQ query to select top five

后端 未结 6 1196
轻奢々
轻奢々 2020-12-02 05:46

I have a LINQ query:

var list = from t in ctn.Items
           where t.DeliverySelection == true && t.Delivery.SentForDelivery == null
           ord         


        
6条回答
  •  遥遥无期
    2020-12-02 06:26

    Additional information

    Sometimes it is necessary to bind a model into a view models and give a type conversion error. In this situation you should use ToList() method.

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

提交回复
热议问题