我的公司名称以小写“i”开头。例如:iWare(这不是真正的公司名称,但可以说明用途)。
因此,我发现由于命名空间命名规则/约定,我经常不得不与 StyleCop 和 Resharper 作斗争。
有没有人知道我应该如何命名我的命名空间(有时是类)。
例如。
namespace iWare.Product.X
{
...
}
可以想象,上面显示的大多数工具都不喜欢这样。是否有任何关于替代方案的建议?我尝试使用以下方法抑制错误:
[SuppressMessage("StyleCop.CSharp.NamingRules", "SA1300:ElementMustBeginWithUpperCaseLetter", Justification = "Reviewed. Suppression is OK here.")]
namespace iWare.Product.X
{
...
}
但是,这会导致以下错误:命名空间声明不能有修饰符或属性
有任何想法吗?
最佳答案
Brett's answer用工具解决了这个问题,但要回答标题中的问题(当公司名称以小写字母开头时,应该使用什么命名空间命名约定):
This MSDN article ,链接来自 this other answer , 状态,
If your brand employs nontraditional casing, you should follow the casing defined by your brand, even if it deviates from normal namespace casing.
因此,根据 Microsoft 的说法,您示例中的正确命名空间名称实际上是
iWare.Product.X
, 带有小写的“i”。
关于visual-studio - [CompanyName] 以小写字母 "i"开头时的命名空间命名约定,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11559768/