title: Deep copy of List<T>
body: <p>I'm trying to make a deep copy of a generic list, and am wondering if there is any other way then creating the copying method and actually copying over each member one at a time. I have a class that looks somewhat like this:</p>
  
  <pre><code>public class Data
  {            
      private string comment;
      public string Comment
      {
          get { return comment; }
          set { comment = value; }
      }
  
      private List&lt;double&gt; traceData;
      public List&lt;double&gt; TraceData
      {
          get { return traceData; }
          set { traceData = value; }
      }
  }
  </code></pre>
  
  <p>And I have a list of the above data, i.e <code>List&lt;Data&gt;</code>. What I'm trying to do is plot a trace data of the subset of List onto a graph, possibly with some scaling or sweeping on the data. I obviously don't need to plot everything in the list because they don't fit into the screen. </p>
  
  <p>I initially tried getting the subset of the list using the <code>List.GetRange()</code> method, but it seems that the underneath <code>List&lt;double&gt;</code> is being shallow copied instead of deep copied. When I get the subset again using List.GetRange(), I get previously modified data, not the raw data retrieved elsewhere.</p>
  
  <p>Can anyone give me a direction on how to approach this? Thanks a lot.</p>