tags:

views:

137

answers:

2

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.

+4  A: 

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
JaredPar
+4  A: 
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.

Fredrik Mörk
Thanks but it's not done for all collections, right?
Joan Venge
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.
Fredrik Mörk