title: C#: Difference between List<T> and Collection<T> (CA1002, Do not expose generic lists)
body: <p>Tried to run Run Code Analysis on a project here, and got a number of warnings that said something like this:</p>
  
  <blockquote>
    <p>CA1002 : Microsoft.Design : Change 'List&lt;<em>SomeType</em>>' in '<em>SomeClass.SomeProtectedOrPublicProperty</em>' to use Collection, ReadOnlyCollection or KeyedCollection</p>
  </blockquote>
  
  <p>Why should I use <code>Collection&lt;T&gt;</code> instead of <code>List&lt;T&gt;</code>? When I look at the msdn documentation, they seem almost equal. After reading the error help for the warning, I found that </p>
  
  <blockquote>
    <p>System.Collections.Generic.List(T)_is a generic collection designed for performance not inheritance and, therefore, does not contain any virtual members.</p>
  </blockquote>
  
  <p>But what does this really mean? And what should I be doing instead?</p>
  
  <p>Should I keep using <code>List&lt;T&gt;</code> internally, and then in the properties return a <code>new Collection&lt;T&gt;(someList)</code> instead? Or should I just start using <code>Collection&lt;T&gt;</code> instead of <code>List&lt;T&gt;</code>?</p>