Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2005
Design Warnings
 Do not expose generic lists
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
Visual Studio Team System
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 System.Collections.Generic.List type, returns a System.Collections.Generic.List type, or whose signature includes a System.Collections.Generic.List parameter.

System.Collections.Generic.List is a generic collection designed for performance not inheritance and, therefore, does not contain any virtual members. The following generic collections are designed for inheritance and should be exposed instead of System.Collections.Generic.List.

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

Do not exclude 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 exclude this warning in a performance tuned application where a performance benefit was gained from the use of generic lists.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
FAQ: Why does DoNotExposeGenericLists recommend that I expose Collection<T> instead of List<T>?      David M. Kean - MSFT   |   Edit   |  

See the following post on the Visual Studio Code Analysis blog:
http://blogs.msdn.com/fxcop/archive/2006/04/27/585476.aspx

Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker