How to made Paging base on SortedList class
-
09-07-2021 - |
Domanda
Hello i have method returned SortedList object I need to do Paging
SortedList output = this.GetSearchResults(SearchQuery.QueryString, se);
ViewBag.ResultSearch = output;
How to make equivalent example in linq
....Skip(100).Take(5);
Thanks
Soluzione
Since a SortedList
does not implement IEnumerable<T>
(unlike SortedList<TKey,TValue>
) you need to cast it to a type to get an IEnumerable<T>
.
For example:
var paged = sl.Cast<Object>()
.Skip(100)
.Take(5);
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow