Tag: take

如何获得总结果数.Take() – 但是在使用时.Take()

我正在使用.Take()来获得固定数量的结果。 获得TotalCountBeforeTake的最佳方式是什么(即好像我没有使用.Take())? 我可以在不运行查询两次的情况下获得TotalCountBeforeTake吗? var Results = (from results in db.FindWords(term) orderby results.word select results.word).Take(100); //just to get the total record count int TotalCountBeforeTake = (from results in db.FindWords(term) select results.word).Count(); // only showing 100 out of TotalCountBeforeTake results, // but in order to know the TotalCountBeforeTake I had to run the query twice. foreach (var […]

如何在查询语法中编写Take(1)

是否可以在LINQ查询语法中编写IQueryable = query.Take(1)或等效的东西。 我正在使用C#5和EF 5。