Okay, right now I've got this statement and it's working well (note I've already sorted the list before executing this statement so Reverse is simply allowing me to pop off the last page):
return results.Take(pageSize * pageIndex).Reverse().Take(pageSize);
But there's got to be a more efficient way ... can anybody show me the way?
Thanks!
There is a Skip operator.
Bypasses a specified number of elements in a sequence and then returns the remaining elements. http://msdn.microsoft.com/en-us/library/bb358985.aspx
For example:
return results.Skip(pageSize * pageIndex).Take(pageSize);
You should probably use Skip
return results.Skip(pageSize * pageIndex).Take(pageSize);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With