public static class Extensions
{
/// <summary>
/// 分页
/// </summary>
/// <param name="list"> 数据源 </param>
/// <param name="page"> 第几页 </param>
/// <param name="size"> 每页记录数 </param>
/// <param name="count"> 记录总数 </param>
/// <returns></returns>
public static IQueryable<T> Pagination<T>( this IQueryable <T> list,int page, int size, out int count)
{
count = list.Count();
return list.OrderBy(t => t).Skip((page-1)*size).Take(size);
}
}