質問

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

役に立ちましたか?

解決

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);
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top