title: Immutable or not immutable?
body: <p>Ok, as I understand it, <em>immutable</em> types are inherently thread safe or so I've read in various places and I think I understand why it is so. If the inner state of an instance can not be modified once the object is created there seems to be no problems with concurrent access to the instance itself.</p>
  
  <p>Therefore, I could create the following <code>List</code>:</p>
  
  <pre><code>class ImmutableList&lt;T&gt;: IEnumerable&lt;T&gt;
  {
      readonly List&lt;T&gt; innerList;
  
      public ImmutableList(IEnumerable&lt;T&gt; collection)
      {
           this.innerList = new List&lt;T&gt;(collection);
      }
  
      public ImmutableList()
      {
           this.innerList = new List&lt;T&gt;();
      }
  
      public ImmutableList&lt;T&gt; Add(T item)
      {
           var list = new ImmutableList&lt;T&gt;(this.innerList);
           list.innerList.Add(item);
           return list;
      }
  
      public ImmutableList&lt;T&gt; Remove(T item)
      {
           var list = new ImmutableList&lt;T&gt;(this.innerList);
           list.innerList.Remove(item);
           return list;
      } //and so on with relevant List methods...
  
      public T this[int index]
      {
          get
          {
              return this.innerList[index];
          }
      }
  
      public IEnumerator&lt;T&gt; GetEnumerator()
      {
          return innerList.GetEnumerator();
      }
  
      System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
      {
          return ((System.Collections.IEnumerable)this.innerList).GetEnumerator();
      }
  }
  </code></pre>
  
  <p>So the question is: Is this <em>really</em> an <em>immutable</em> type? Is it really thread safe?</p>
  
  <p>Obviously the type itself is <em>immutable</em> but there is absolutely no garantee that <code>T</code> is and therefore you could have concurrent access and threading issues related directly with the generic type. Would that mean that <code>ImmutableList</code> should be considered <em>mutable</em>?.</p>
  
  <p>Should <code>class ImmutableList&lt;T&gt;: IEnumerable&lt;T&gt; where T: struct</code> be the only type truly considered <em>immutable</em>?</p>
  
  <p>Thanks for any input on this issue.</p>
  
  <p><strong>UPDATE</strong>: A lot of answers/comments are concentrating on the particular implementation of <code>ImmutableList</code> I've posted which is probably not a very good example. But the issue of the question is not the implementation. The question I'm asking is if <code>ImmutableList&lt;MutableT&gt;</code> is really an immutable type considering everything that an immutable type entails.</p>