开发者

Select top 5 from a merged list (MVC)

开发者 https://www.devze.com 2023-01-10 10:22 出处:网络
I have two lists that have been merged.After a order by linq st开发者_运维问答atement, I would like to select the top 5 from that complete list.I was thinking about using the linq statement to pick th

I have two lists that have been merged. After a order by linq st开发者_运维问答atement, I would like to select the top 5 from that complete list. I was thinking about using the linq statement to pick the top 5 from the list.

var ListSort = from list in NewList
orderby list.EntryDate
select list;//Tried to select the top 5 from here

Any other suggestions on how to do this?


if you are going to use Linq, then use the Take statement

   myList.Take(5)
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号