title: Cloning List<T>
body: <p>I thought that to clone a List you would just call:</p>
  
  <pre><code>List&lt;int&gt; cloneList = new List&lt;int&gt;(originalList);
  </code></pre>
  
  <p>But I tried that in my code and I seem to be getting effects that imply  the above is simply doing:</p>
  
  <p>cloneList = originalList...  because changes to cloneList seem to be affecting originalList.</p>
  
  <p>So what is the way to clone a List?</p>
  
  <p>EDIT:</p>
  
  <p>I am thinking of doing something like this:</p>
  
  <pre><code>public static List&lt;T&gt; Clone&lt;T&gt;(this List&lt;T&gt; originalList) where T : ICloneable
  {
      return originalList.ConvertAll(x =&gt; (T) x.Clone());
  }
  </code></pre>
  
  <p>EDIT2:</p>
  
  <p>I took the deep copy code suggested by Binoj Antony and created this extension method:</p>
  
  <pre><code>public static T DeepCopy&lt;T&gt;(this T original) where T : class
  {
      using (MemoryStream memoryStream = new MemoryStream())
      {
          BinaryFormatter binaryFormatter = new BinaryFormatter();
          binaryFormatter.Serialize(memoryStream, original);
          memoryStream.Seek(0, SeekOrigin.Begin);
          return (T)binaryFormatter.Deserialize(memoryStream);
      }
  }
  </code></pre>
  
  <p>EDIT3:</p>
  
  <p>Now, say the items in the List are structs.  What then would result if I called?:</p>
  
  <pre><code>List&lt;StructType&gt; cloneList = new List&lt;StructType&gt;(originalList);
  </code></pre>
  
  <p>I am pretty sure than I would get a List filled with new unique items, correct?</p>