I have an Interface IPager
public interface IPager
{
int RecordCount { get; }
int PageNumber { get; }
int PageSize { get; }
}
public static class PagerExtensions
{
public static int GetPageCount(this IPager pager)
{
var totalPages = pager.RecordCount / pager.PageSize;
if (pager.RecordCount % pager.PageSize > 0)
totalPages += 1;
return totalPages;
}
}
Does GetTotalPages sound more conventional than GetPageCount?
To me GetPageCount sounds better because it is closer to usual usage of code like
x.Countorx.Count()for the Linq extension.And so, it clearly explains itself.
Get– as in, return something.Page– the variable in question, andCount– as in the method who’s return value is returned when applied to the variable in question.