3

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.

2 Answers 2

4

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
4
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.

1
  • No, unfortunately there are some inconsistencies within the BCL; List and LinkedList as you pointed out, XmlNodeList and ArrayList (which in itself is a sort of strange type name) and a bunch of others I guess. I would agree that this particular FxCop rule might not be the most valuable one. May 10, 2009 at 18:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.