标识符应具有正确的后缀 (fxcop)

发布于 2024-07-19 14:31:06 字数 145 浏览 4 评论 0原文

我正在编写的集合出现此错误,但 fxcop 警告我在其后面添加集合后缀。 为什么?

没有 .NET 集合可以做到这一点,对吧? 即 ListLinkedList 等。

I got this error for a collection I am writing, but fxcop warned me to suffix it with collection. Why?

No .NET collection does this, right? i.e. List<T>, LinkedList<T>, etc.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

朦胧时间 2024-07-26 14:31:06

这是我忽略的 FxCop 规则,原因与您所描述的几乎完全相同。 我也觉得在大多数情况下它没有增加任何价值。 我通常在我的所有项目中将其关闭。

第二个原因是,如果遵循规则,它会产生一些非常奇怪的类名(特别是与 Tree 组合时)

  • AvlTreeCollection
  • ImmutableAvlTreeCollection
  • HeapCollection

This is one FxCop rule I ignore for pretty much the exact reason you describe. also I feel that in the majority of cases it adds no value. I usually turn it off in all of my projects.

The second reason is that if you follow the rule, it produces some really odd class names (especially when combined with Tree)

  • AvlTreeCollection
  • ImmutableAvlTreeCollection
  • HeapCollection
留蓝 2024-07-26 14:31:06
System.Collections.ObjectModel.ObservableCollection<T>
System.Collections.Generic.SynchronizedCollection<T>
System.Collections.Generic.SynchronizedKeyedCollection<K, T>
System.Collections.ObjectModel.ReadOnlyCollection<T>
System.Collections.Specialized.NameObjectCollectionBase.KeysCollection
System.Windows.Forms.ListViewGroupCollection
System.Windows.Forms.ListView.ListViewItemCollection

...在其他人中。

System.Collections.ObjectModel.ObservableCollection<T>
System.Collections.Generic.SynchronizedCollection<T>
System.Collections.Generic.SynchronizedKeyedCollection<K, T>
System.Collections.ObjectModel.ReadOnlyCollection<T>
System.Collections.Specialized.NameObjectCollectionBase.KeysCollection
System.Windows.Forms.ListViewGroupCollection
System.Windows.Forms.ListView.ListViewItemCollection

...amongst others.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文