What's the Linq to SQL equivalent to TOP or LIMIT/OFFSET?

前端 未结 14 1276
野性不改
野性不改 2020-12-12 15:19

How do I do this

Select top 10 Foo from MyTable

in Linq to SQL?

14条回答
  •  渐次进展
    2020-12-12 15:49

    This way it worked for me:

    var noticias = from n in db.Noticias.Take(6)
                           where n.Atv == 1
                           orderby n.DatHorLan descending
                           select n;
    

提交回复
热议问题