コード例 #1
0
        private static void SetAnchor <TKey, TValue>(List <KeyValuePair <TKey, TValue> > list, PagingPredicate <TKey, TValue> pagingPredicate, int nearestPage)
        {
            if (list.Count == 0)
            {
                return;
            }

            int size     = list.Count;
            int pageSize = pagingPredicate.GetPageSize();

            for (int i = pageSize; i <= size; i += pageSize)
            {
                KeyValuePair <TKey, TValue> anchor = list[i - 1];
                nearestPage++;
                pagingPredicate.SetAnchor(nearestPage, anchor);
            }
        }
コード例 #2
0
        private static void SetAnchor <TKey, TValue>(IList <KeyValuePair <TKey, TValue> > list,
                                                     PagingPredicate pagingPredicate, int nearestPage)
        {
            if (list.Count == 0)
            {
                return;
            }
            var size     = list.Count;
            var pageSize = pagingPredicate.PageSize;
            var page     = pagingPredicate.Page;

            for (var i = pageSize; i <= size && nearestPage < page; i += pageSize)
            {
                var anchor = list[i - 1];
                nearestPage++;
                pagingPredicate.SetAnchor(nearestPage, anchor.Key, anchor.Value);
            }
        }