Linq to SQL - Return top n rows

jinsungy picture jinsungy · Apr 24, 2009 · Viewed 88.8k times · Source

I want to return the TOP 100 records using Linq.

Answer

tvanfosson picture tvanfosson · Apr 24, 2009

Use the Take extension method.

var query = db.Models.Take(100);