title: Why there isn't a ReadOnlyList<T> class in the System.Collections library of C#?
body: <p>Reading about the problem of creating a read only primitive vector in C# (basically, you cannot do that),</p>
  
  <pre><code>public readonly int[] Vector = new int[]{ 1, 2, 3, 4, 5 }; // You can still changes values
  </code></pre>
  
  <p>I learnt about <code>ReadOnlyCollectionBase</code>. This is a base class for containers of objects that let their positions be accessed but not modified. Even there is an example in <em>Microsoft Docs</em>.</p>
  
  <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.collections.readonlycollectionbase" rel="nofollow noreferrer">ReadOnlyCollectionBase Class - Microsoft Docs</a></p>
  
  <p>I slightly modified the example to use any type:</p>
  
  <pre><code>public class ReadOnlyList&lt;T&gt; : ReadOnlyCollectionBase {
      public ReadOnlyList(IList sourceList)  {
        InnerList.AddRange( sourceList );
      }
  
      public T this[int index]  {
        get  {
           return( (T) InnerList[ index ] );
        }
      }
  
      public int IndexOf(T value)  {
        return( InnerList.IndexOf( value ) );
      }
  
  
  
      public bool Contains(T value)  {
        return( InnerList.Contains( value ) );
      }
  
  }
  </code></pre>
  
  <p>... and it works. My question is, why does not exist this class in the standard library of C#, probably in <code>System.Collections.Generic</code>? Am I missing it? Where is it?
  Thank you.</p>