문제

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