示例#1
0
 public ListPeople Add(ListPeople listPeople)
 {
     if (listPeople == null)
     {
         throw new ArgumentNullException("listpeople");
     }
     listPeople.Name = newname;
     people.Add(listPeople);
     return(listPeople);
 }
示例#2
0
        public bool Update(ListPeople listPeople)
        {
            if (listPeople == null)
            {
                throw new ArgumentNullException("listpeople");
            }
            int index = people.FindIndex(b => b.Name == listPeople.Name);

            if (index == -1)
            {
                return(false);
            }
            people.RemoveAt(index);
            people.Add(listPeople);
            return(true);
        }