Пример #1
0
 public Person Copy()
 {
     Person newPerson = new Person();
     newPerson.FormPerson(id, name, lastName);
     for (int i = 0; i < phones.Count; i++)
     {
         newPerson.phones.Add(phones[i].Copy());
     }
     return newPerson;
 }
Пример #2
0
 public Person Parse(string line)
 {
     Person person = new Person();
     person.FormPerson(Convert.ToInt32(line.Split('=')[0]), line.Split('=')[1], line.Split('=')[2]);
     string[] phones = line.Split('=');
     for (int i = 3; i < phones.Length; i++)
     {
         Phone phone = new Phone(phones[i]);
         person.AddPhone(phone);
     }
     return person;
 }
Пример #3
0
 private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     int rowIndex = dataGridView1.SelectedRows[0].Index;
     selectedPerson = persons[rowIndex].Copy();
     newPerson=persons[rowIndex].Copy();
 }