How to fully pass a List? : <p>I use a list to contain data parsed from an XML file, using strings as its members:</p>

<pre><code>public class ServerList
{
    public string ServerName { set; get; }
    public string ServerReboot { set; get; }
    public string ServerShutdown { set; get; }

    public ServerList()
    {
        ServerName = "";
        ServerReboot = "";
        ServerShutdown = "";
    }
}
</code></pre>

<p>From the main form I launch an editor form and pass the list into it.  On this editor form the user is able to add or remove entry entries form the list, as well as make changes to parts of the list.  If they click the OK button I want to be able to pull the list form the editor form back into the main form, but if they click Cancel I want these changes to get dropped.  This is the way the editor form is pulled up:</p>

<pre><code>    private void mnuEdit_Click(object sender, EventArgs e)
    {
        frmEditor theEditor = new frmEditor();
        theEditor.updatedServerList = theServerList;
        DialogResult res = theEditor.ShowDialog();

        if (res == DialogResult.OK)
        {
            theServerList = theEditor.updatedServerList.ToList();
            SetupFilters(GroupOrBatch.Group);
            // other processing to update the main form from the updated list
        }
    }
</code></pre>

<p>And on the Edit form this is how it is received:</p>

<pre><code>public partial class frmEditor : Form
{
    private List&lt;ServerList&gt; myServerList = new List&lt;ServerList&gt;();

    public List&lt;ServerList&gt; updatedServerList
    {
        get { return myServerList; }
        set { myServerList = value.ToList(); }
    }
....
</code></pre>

<p>What I am finding is that while the list structure appears to be copied to the new variable, the actual data is still linked to the original list.  Even if the user clicks Cancel, and the modified list is not copied back to the original, the original has already been changed.</p>

<p>This leaves me with one of two options - either I can find some way to do a full deep clone of the list to a new one (which can be dropped upon an Cancel), or I remove the Cancel button entirely and have all edits be live.  </p>
