Beispiel #1
0
        public object DeepCopy()
        {
            List_Person NewList = new List_Person();

            if (Persons != null)
            {
                NewList.Persons.AddRange(this.Persons);
            }
            return(NewList);
        }
Beispiel #2
0
        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);
            }
        }
Beispiel #3
0
        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);
            }
        }