linq分页扩展(转)
2024-09-24 12:30:13
原文地址:http://www.cnblogs.com/RainbowInTheSky/p/4590508.html
public static List<T> ToPagedList<T>(this IEnumerable<T> allItems, int pageIndex, int pageSize, Expression<Func<T, int>> keySelector)
{
var itemList = allItems.Skip(pageSize * (pageIndex - )).Take(pageSize).ToList();
return itemList;
}
public static List<T> ToPagedList<T>(this IEnumerable<T> allItems, int pageIndex, int pageSize, Expression<Func<T, bool>> keySelector)
{
var itemList = allItems.Skip(pageSize * (pageIndex - )).Take(pageSize).ToList();
return itemList;
}
public static List<T> ToPagedList<T>(this IEnumerable<T> allItems, int pageIndex, int pageSize, Expression<Func<T, string>> keySelector)
{
var itemList = allItems.Skip(pageSize * (pageIndex - )).Take(pageSize).ToList();
return itemList;
}
public static List<T> ToPagedList<T>(this IEnumerable<T> allItems, int pageIndex, int pageSize, Expression<Func<T, DateTime>> keySelector)
{
var itemList = allItems.Skip(pageSize * (pageIndex - )).Take(pageSize).ToList();
return itemList;
}
public static List<T> ToPagedList<T>(this IQueryable<T> allItems, int pageIndex, int pageSize, Expression<Func<T, int>> keySelector)
{
var itemList = allItems.OrderBy(keySelector).Skip(pageSize * (pageIndex - )).Take(pageSize).ToList();
return itemList;
}
public static List<T> ToPagedList<T>(this IQueryable<T> allItems, int pageIndex, int pageSize, Expression<Func<T, bool>> keySelector)
{
var itemList = allItems.OrderBy(keySelector).Skip(pageSize * (pageIndex - )).Take(pageSize).ToList();
return itemList;
}
public static List<T> ToPagedList<T>(this IQueryable<T> allItems, int pageIndex, int pageSize, Expression<Func<T, string>> keySelector)
{
var itemList = allItems.OrderBy(keySelector).Skip(pageSize * (pageIndex - )).Take(pageSize).ToList();
return itemList;
}
public static List<T> ToPagedList<T>(this IQueryable<T> allItems, int pageIndex, int pageSize, Expression<Func<T, DateTime>> keySelector)
{
var itemList = allItems.OrderBy(keySelector).Skip(pageSize * (pageIndex - )).Take(pageSize).ToList();
return itemList;
}
最新文章
- Java.web-application-development-environments-for-macosx
- 数据库同步工具HKROnline SyncNavigator SQL Server互同步MySQL
- 理解css中的line-height
- 支持正则或通配符的hashmap
- 从输入 URL 到页面加载完的过程中都发生了什么---优化
- Java 8 vs. Scala(二):Stream vs. Collection
- windows mobile 6.5 隐藏 左下角(左上角)的开始按钮 叉号关闭按钮
- IT定理:摩尔定理,安迪-比尔定理,反摩尔定理
- dephi中单击鼠标拖动窗口(使用WM_SYSCOMMAND)
- 最简单的入门github
- 第五章——定时器Timer序言
- cs231n spring 2017 lecture7 Training Neural Networks II 听课笔记
- js解决IE8不支持html5,css3的问题(respond.js 的使用注意)
- 使用Docker部署Spring boot项目
- Unity-批量修改Prefab上的属性
- php 默认保几位小数,末尾为0去掉
- web前端知识大纲:系列二 css篇
- vue 坑 checked 和v-model共用
- tp未验证内容-9
- urllib2 post请求方式,带cookie,添加请求头