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

È stato utile?

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
scroll top