Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize

CA1002: Do not expose generic lists

TypeName

DoNotExposeGenericLists

CheckId

CA1002

Category

Microsoft.Design

Breaking Change

Breaking

A type contains an externally visible member that is a List type, returns a List type, or whose signature includes a List parameter.

List is a generic collection that is designed for performance and not inheritance. List does not contain virtual members that make it easier to change the behavior of an inherited class. The following generic collections are designed for inheritance and should be exposed instead of List.

To fix a violation of this rule, change the List type to one of the generic collections that is designed for inheritance.

Do not suppress a warning from this rule unless the assembly that raises this warning is not meant to be a reusable library. For example, it would be safe to suppress this warning in a performance tuned application where a performance benefit was gained from the use of generic lists.

Show:
© 2015 Microsoft