title: how to copy list<object> without reference C#
body: <pre><code>using System.Runtime.Serialization.Formatters.Binary;
  
  public class MatchTeam
     {
         public int StudentID { get; set; }
         public int PositionName { get; set; }
         public int GroupTeamNumber { get; set; }
     }
  
  [Serializable]
  
     public class MatchTeamModel : ICloneable
     {
         public List&lt;MatchTeam&gt; MatchAllStudentList { get; set; }
  
         public object Clone()
         {
             using (MemoryStream stream = new MemoryStream())
             {
                 if (this.GetType().IsSerializable)
                 {
                     BinaryFormatter formatter = new BinaryFormatter();
                     formatter.Serialize(stream, this);
                     stream.Position = 0;
                     return formatter.Deserialize(stream);
                 }
                 return null;
             }
         }
     }
  
  </code></pre>
  <p>Asp.net mvc</p>
  <pre><code>
   MatchTeamModel Firstlist= new MatchTeamModel
              {
                  MatchAllStudentList = new List&lt;MatchTeam&gt;()
              };
  
   MatchTeamModel Secondlist = new MatchTeamModel
              {
                  MatchAllStudentList = new List&lt;MatchTeam&gt;()
              };
  
  MatchTeam MT1 = new MatchTeam { StudentID = 1,Positionname = center,groupteamnumber = 1};
  MatchTeam MT2 = new MatchTeam { StudentID = 2 ,Positionname = Forward ,groupteamnumber = 1};
  MatchTeam MT3 = new MatchTeam { StudentID = 3,Positionname = Guard,groupteamnumber = 1};
  MatchTeam MT4 = new MatchTeam { StudentID = 4,Positionname = center,groupteamnumber = 2};
  MatchTeam MT5 = new MatchTeam { StudentID = 5,Positionname = Forward,groupteamnumber = 2};
  MatchTeam MT6 = new MatchTeam { StudentID = 6,Positionname = Guard,groupteamnumber = 2};
  
  Firstlist.MatchAllStudentList.Add(MT1)
  Firstlist.MatchAllStudentList.Add(MT2)
  Firstlist.MatchAllStudentList.Add(MT3)
  Firstlist.MatchAllStudentList.Add(MT4)
  Firstlist.MatchAllStudentList.Add(MT5)
  Firstlist.MatchAllStudentList.Add(MT6)
  
  
  
  Secondlist = Firstlist;
  </code></pre>
  <p>When i swap or change in Firstlist , Secondlist change too. I need to change some data in Firstlist as
  swap MT5 and MT2 but don't change in Firstlist and i try to use deepcopy in MatchTeamModel  but it's not work or maybe i use incorrect. someone pls correct me if i wrong</p>
  <p>and if i use</p>
  <pre><code>Secondlist = Firstlist.Clone() as MatchTeamModel;
  </code></pre>
  <p>i have this error</p>
  <blockquote>
  <p>System.Runtime.Serialization.SerializationException: 'Type
  'Testcloneobject.Models.MatchTeam' in Assembly 'Testcloneobject,
  Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked
  as serializable.</p>
  </blockquote>