title: LINQ to Objects, how to update items within List in place?
body: <p>I currently have the following working code. It is painfully slow however. I know that passing the holdings as a query rather than as a list might simplify and speed up things, but for various reasons this is not possible.</p>
  
  <p>How can I update the list of holdings in place, without creating a new list? Other suggestions to improve the code?</p>
  
  <pre><code>internal List&lt;DailyHoldingItem&gt; TransformHoldingItemsToCurrency(List&lt;DailyHoldingItem&gt; holdings,string toCurrency)
          {
          //TODO - how to do this calculation in place, without creating a new list?
          var query = (from holding in holdings
                       from fxRateHolding in amdw.FXRates
                       from fxRateToCur in amdw.FXRates
                       where
                       fxRateHolding.BaseCurrency == holding.Currency &amp;&amp;
                       fxRateToCur.BaseCurrency == toCurrency &amp;&amp;
                       fxRateHolding.ValueDate == holding.Date &amp;&amp;
                       fxRateToCur.ValueDate == holding.Date
                       select new { holding, fxRateHolding, fxRateToCur });
  
          return query.Select(dhi =&gt;
          {
              decimal factor = dhi.fxRateToCur.Value / dhi.fxRateHolding.Value;
              dhi.holding.MarketValue *= factor;
              dhi.holding.Fee *= factor;
              dhi.holding.Remuneration *= factor;
              return dhi.holding;
          }).ToList();
  
      }
  </code></pre>