How to get top 10 records in linq

In this article i am explaining how to get top 10 records in LINQ. below is very simple and easy example.

var top10 = (from u in db.Users
           orderby u.UserId descending
           select u).Take(10);

Note: If you take method then must be use order by clause.


Leave a Reply

Your email address will not be published. Required fields are marked *