Beispiel #1
0
 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 ;
 }
Beispiel #2
0
 //
 public void Add(Person  newPerson)
 {
     Dictionary.Add(newPerson.Name ,newPerson );
 }