public object Clone() { People clonePeople = new People(); Person currentPerson, newPerson; foreach (DictionaryEntry p in Dictionary ) { currentPerson = p.Value as Person; newPerson =new Person (): newPerson.Name=currentPerson .Name; newPerson.Age=currentPerson .Age; clonePeople .Add(newPerson); } return clonePeople ; }
// public void Add(Person newPerson) { Dictionary.Add(newPerson.Name ,newPerson ); }