public object DeepCopy() { List_Person NewList = new List_Person(); if (Persons != null) { NewList.Persons.AddRange(this.Persons); } return(NewList); }
public bool Load(string filename) { BinaryFormatter formatter = new BinaryFormatter(); try { using (FileStream fs = new FileStream(filename, FileMode.Open)) { List_Person newS = (List_Person)formatter.Deserialize(fs); this.Persons = newS.Persons; } return(true); } catch { return(false); } }
public bool Save(string filename) { List_Person s = DeepCopy() as List_Person; BinaryFormatter formatter = new BinaryFormatter(); try { using (FileStream fs = new FileStream(filename, FileMode.Create)) { formatter.Serialize(fs, s); } return(true); } catch { return(false); } }