Code Analysis rule about IEnumerable leads to misleading naming - by ploeh

Status : 


Sign in
to vote
ID 771480 Comments
Status Active Workarounds
Type Bug Repros 0
Opened 11/17/2012 6:00:54 AM
Access Restriction Public


Code Analysis rule "CA1710: Identifiers should have correct suffix" leads to misleading names.

Particularly, the rule that classes implementing IEnumerable should have a "Collection" suffix is misleading because a 'Collection' implies more functionality than a mere Iterator. To wit: the ICollection interface adds 4 more members on top of IEnumerable.

A pure IEnumerable implementation might be a Generator (i.e. an Iterator that never ends), so in this case the IColleciton.Count property is meaningless. Thus, it's misleading to name an IEnumerable implementation with a "Collection" suffix.
Sign in to post a comment.
Posted by ploeh on 5/8/2013 at 11:25 AM
While I understand that you're busy, you could at least change the "When to suppress" section of the documentation, stating that it's OK to suppress this warning.
Posted by Alex [MSFT] on 4/26/2013 at 4:02 PM
Thanks for reporting this issue you've encountered with code analysis rules in Visual Studio!

We agree that this rule is pretty outdated at this point - IEnumerable has taken on a whole new importance since LINQ, and many IEnumerable locations will represent views over data, rather than logical "collections".

We'd like to just pull this rule out, but our triage bar is quite high for rules issues in this release. Unfortunately, we won't be able to remove this rule in the next version of Visual Studio.

Alex Turner
Senior Program Manager
Visual Basic and C# Compiler
Posted by Microsoft on 11/22/2012 at 1:42 AM
Thank you for submitting feedback on Visual Studio and .NET Framework. Your issue has been routed to the appropriate VS development team for investigation. We will contact you if we require any additional information.
Posted by Microsoft on 11/19/2012 at 6:38 PM
Thanks for your feedback.

In order to fix the issue, we must first reproduce the issue in our labs. In order to efficiently investigate and reproduce this issue, we are requesting additional information outlined below.

Could you please give us a demo project so that we can conduct further research?

Please submit this information to us within 3 business days. We look forward to hearing from you with this information.

Microsoft Visual Studio Connect Support Team
Posted by Microsoft on 11/19/2012 at 9:50 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(