Better way to write this code rather than 2x foreach?
<pre><code>    List&lt;CormantRadPane&gt; panesToSave = new List&lt;CormantRadPane&gt;();

    foreach (KeyValuePair&lt;string, RadPaneSetting&gt; paneState in RadControlStates.PaneStates)
    {
        CormantRadPane pane = Utilities.FindControlRecursive(Page, paneState.Key) as CormantRadPane;
        panesToSave.Add(pane);
    }

    foreach (CormantRadPane pane in panesToSave)
    {
        RadControlSave.SavePane(pane);
    }
</code></pre>

<p>RadControlSave.SavePane(pane) modifies the RadControlStates.PaneStates collection. Is there a nicer way to write this code in this situation?</p>

<p>EDIT: Everyone please read what I wrote literally right above this. Jimmy posted an obvious solution that I hadn't though about -- creating a copy of the collection right before iterating through it so that RadControlSave does not modify the collection being iterated upon. </p>
