Accepted answer

You can use the Take() method

List<aspnet_News> allNews = context.aspnet_News.OrderByDescending(i => i.NewsId)
                                               .Take(3)  // Takes the first 3 items

It'll also handle the case where the list contains less than 3 items and take them only.


Use method Take() and if you need, you can use Skip() as well.

How to get first N elements of a list in C#?

Related Query

More Query from same tag