'What is the best method to paginate a C# list without using LINQ?
I need to paginate a C# List<> without using LINQ since I'm using .NET framework 3.0. What is the best way to do this?
What I need to do is read a list of files from a folder and display them in a gridview with pagination.
Solution 1:[1]
You could try using a GetRange operation, I suppose if this is a requirement. Try something like:
List<Foo> foos = new List<Foo>();
var items = foos.GetRange(0, 5);
So that'd get the first 5 elements, you'd obviously want to grab as many elements as you wanted. Starting from (count + element) next time around.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Vaughan Hilts |
