【发布时间】:2014-01-20 09:16:35
【问题描述】:
我们遵循匈牙利符号来声明私有变量,如下所示。
private IRepository<Request> _requestRepo;
public RequestService(IRepository<Request> requestRepo)
{
_requestRepo = requestRepo;
}
上面的代码显示了一个声纳问题,例如字段名称不以下划线开头。请告诉我如何声明私有变量以满足编码标准?
【问题讨论】:
-
不以下划线开头,或暂时禁用警告 (
SuppressMessage) 或完全禁用规则。见To underscore or to not to underscore, that is the question。