C# 返回分页查询的总页数

时间:2020-12-09 05:45:51
/// <summary>
///  返回分页查询操作的的总页数
/// </summary>
/// <param name="count">总条数</param>
/// <param name="pageSize">每页返回条数</param>
/// <returns></returns>
public static int totalPages(int count, int pageSize)
{
    float d = (float)count / pageSize;
    return (int)Math.Ceiling(d);
}