static void Main(string[] args) { List<Person> persons = new List<Person>() { new Person("Vasilka", 29), new Person("Kalinkata", 40), new Person("Milenkata", 30, "*****@*****.**"), new Person("Vancheto",72,"*****@*****.**"), }; foreach (Person person in persons) { Console.WriteLine(person.ToString()); } Person david = new Person("David", 43, "david");//throws new argument exceptions }
static void Main(string[] args) { Person person = new Person("Ivan",22); Console.WriteLine(person.ToString()); }