private Dictionary <Person, string> GeneratePersonsDictionary(int count) { if (count <= 0) { throw new ArgumentException("#GeneratePersonsDictionary error# " + "присвоенно неверное знаечение параметру count"); } var dict = new Dictionary <Person, string>(); for (int i = 0; i < count; i++) { try { var person = GeneratorFromPerson.GeneratePerson(); string workPlace = GeneratorFromPerson.GeneratorPersonWorkPlace(); dict.Add(person, workPlace); } catch (ArgumentException) { Console.WriteLine("#GeneratePersonsDictionary error# ArgumentException при добавление эл-а в словарь"); } } return(dict); }
private List <Person> GeneratePersonsList(int count) { if (count <= 0) { throw new ArgumentException("#GeneratePersonsDictionary error# " + "присвоенно неверное знаечение параметру count"); } var list = new List <Person>(); for (int i = 0; i < count; i++) { try { var person = GeneratorFromPerson.GeneratePerson(); list.Add(person); } catch (ArgumentException) { Console.WriteLine("#GeneratePersonsList error# ArgumentException при добавление эл-а в словарь"); } } return(list); }