Questions tagged [skip-take]

21 questions
1
vote
2 answers

Possible multiple enumeration of IEnumerable when counting and skipping

I'm preparing data for a datatable in Linq2Sql This code highlights as a 'Possible multiple enumeration of IEnumerable' (in Resharper) // filtered is an IEnumerable or an IQueryable var total = filtered.Count(); var displayed = filtered …
Peter
  • 7,792
  • 9
  • 63
  • 94
0
votes
0 answers

EF Core 3.0 using Skip() and Take() in queries with nested collection projections

I'm using EF Core 3.0.1 in my project and I need to perform nested projections in sql instead of client-side. public class Order { public int Id {get;set;} public ICollection Details {get;set;} } public class Detail { public…
0
votes
6 answers

Trouble getting total count using .Take() and .Skip()

I'm having some trouble implementing some paging using Linq and I've read the various questions (this and this for example) on here but I'm still getting the error; System.InvalidOperationException: The result of a query cannot be enumerated more…
tominyorks421
  • 73
  • 1
  • 10
0
votes
0 answers

Linq Skip()-Take()

I have a problem about Skip-Take. Below you can find my code block. Normally, I have 9 items. When I try to use Skip-Take and I want to take 4 items on every pages, the result returns like this: page index=1 item count=3, page index=2 item count=2,…
Johnny
  • 459
  • 1
  • 4
  • 12
0
votes
3 answers

Loop through observable collection to create a new observable collection

Hi everyone I have an observable collection and what I want is to create a new observable collection that will take the first 6 objects of the original one and skip the next 12 but on a loop so take 6 skip 12 take 6 skip 12 as long as there are…
Dino Kantardzic
  • 97
  • 1
  • 4
  • 13
-4
votes
1 answer

I am try to Pagination using Skip Take in Code Frist Approach But given Error

I am trying to Pagination using Skip Take in Code First Approach But given Error. Method [HttpPost] [Route("Paging")] public async ActionResult> Paging(int CurrentPage) { CurrentPage = CurrentPage; …
1
2