MrM
MrM

Reputation: 21989

Select top 5 from a merged list (MVC)

I have two lists that have been merged. After a order by linq statement, 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?

Upvotes: 0

Views: 1964

Answers (1)

Muad'Dib
Muad'Dib

Reputation: 29216

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

   myList.Take(5)

Upvotes: 3

Related Questions