分页总数计算,根据总记录数获取分页总数
int pageSize = 20; //每页记录数量
int totalCount = 100005; //总记录数
int pageCount; //总页数
//方法一:
pageCount = (totalCount + pageSize - 1) / pageSize; //推荐写法
//方法二:
pageCount = (totalCount - 1) / pageSize + 1;
//方法三:
pageCount = (int)Math.Ceiling((double)totalCount / pageSize);
//方法四:
pageCount = (int)Math.Ceiling((double)totalCount / pageSize);
//方法五:
pageCount = totalCount%pageSize == 0 ? totalCount/pageSize : totalCount/pageSize + 1;
结果强转成 int 就为 page页数