相关疑难解决方法(0)

"foos数量"变量的命名约定

假设我需要在变量中存储foo对象的数量.

不是母语为英语的人,我总是想知道那个var的最佳名称(简短且立即清晰).

foo_numnum_foono_foofoo_no?或者是其他东西?

全名应该是number_of_foos,但它有点冗长.

你最喜欢什么,为什么?

naming-conventions

72
推荐指数
6
解决办法
1万
查看次数

API:C#方法命名约定:GetPageCount或GetTotalPages

我有一个界面 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;
    }
}
Run Code Online (Sandbox Code Playgroud)

是否GetTotalPages听起来比更传统GetPageCount

c# api naming-conventions

1
推荐指数
1
解决办法
596
查看次数

标签 统计

naming-conventions ×2

api ×1

c# ×1