title: Array Clone & Copy still effect original
body: <p>I am passing in an array of objects which I want UNTOUCHED but for some reason no matter what I try the original array passed in is being changed.</p>
  
  <pre><code>private DSPPositionPeriodDO[] CompactShortTermData(DSPPositionPeriodDO[] data)
  {
      DSPPositionPeriodDO[] resultArray = (DSPPositionPeriodDO[])data.Clone();
      int? hoursToAggBy = null;
      // it is short term, the data gets too much so decide how many
      // hours to aggregate by.
      var days = (_endDate - _startDate).TotalDays;
      if (days &lt;= 3)
          hoursToAggBy = null;
      else if (days &gt; 3 &amp;&amp; days &lt;= 7)
          hoursToAggBy = 1;
      else if (days &gt; 7 &amp;&amp; days &lt;= 14)
          hoursToAggBy = 2;
      else if (days &gt; 14 &amp;&amp; days &lt;= 21)
          hoursToAggBy = 3;
      else if (days &gt; 21)
          hoursToAggBy = 4;
  
      if (hoursToAggBy != null)
      {
          // round down hours
          foreach (var posPeriod in resultArray)
          {
              var sl = posPeriod.StartLocal;
              sl = sl.AddHours(-(sl.Hour % hoursToAggBy.Value));
              sl = sl.AddMinutes(-sl.Minute);
              posPeriod.StartLocal = sl;
          }
  
          // group by entity &amp; time -- get average
          var groupedData = resultArray.GroupBy(x =&gt; new
          {
              x.EntityId,
              x.EntityCode,
              x.StartLocal
          })
          .Select(g =&gt; new DSPPositionPeriodDO
          {
              EntityId = g.Key.EntityId,
              EntityCode = g.Key.EntityCode,
              StartLocal = g.Key.StartLocal,
              Volume = g.Average(v =&gt; v.Volume),
              AverageVolume = null
          });
  
          resultArray = groupedData.ToArray();
      }
  }
  </code></pre>
  
  <p>I have tried to create a seperate copy like :</p>
  
  <p><code>var x = original.ToArray()</code></p>
  
  <p><code>toList()</code></p>
  
  <p><code>Clone()</code></p>
  
  <p>etc.</p>
  
  <p>By <code>original</code> I mean the <code>data</code> object being passed in. I wish it not to be changed at all.</p>