static void Main(string[] args) { Person first = new Person("Petro", "Gora", new DateTime(2000, 5, 23)); Console.WriteLine(first.ToString()); Console.WriteLine(first.ToShortString()); Person second = new Person(); Console.WriteLine(second.ToString()); Console.WriteLine(second.ToShortString()); ResearchTeam third = new ResearchTeam(); ResearchTeam team = new ResearchTeam(); Paper[] papers = new Paper[2]; papers[0] = new Paper("pub_4", new Person("Anton", "Bahok", new DateTime(1980, 4, 24)), new DateTime(1887, 6, 1)); papers[1] = new Paper("pub_5", new Person("Petro", "Bahok", new DateTime(1980, 4, 24)), new DateTime(1889, 8, 21)); team.AddPapers(papers); foreach (Paper paper in team.list) { Console.WriteLine(paper.nameOfPublication); Console.WriteLine(paper.Time.ToShortDateString()); } Console.WriteLine(third.ToShortString()); Console.WriteLine(team.ToString()); Console.ReadKey(); }
public object DeepCopy() { ResearchTeam CopyTeam = new ResearchTeam(this.nameOfOrganization, this.Theme, this.idOfOrganization, this.ResearchDuration); CopyTeam.ListOfPublication = ListOfPublication; CopyTeam.ListOfParticipants = ListOfParticipants; return(CopyTeam); }
static void Main(string[] args) { Team Team1 = new Team("Linuvtsi", 7); Team Team2 = new Team("Linuvtsi", 7); Console.WriteLine(Team1.Equals(Team2)); Console.WriteLine(Team1 == Team2); Console.WriteLine(string.Format(" MyTeam1: {0}, MyTeam2: {1} ", Team1.GetHashCode(), Team2.GetHashCode())); try { Team2.ID = -2; } catch (ArgumentOutOfRangeException ex) { Console.WriteLine(ex.Message); } ResearchTeam Team3 = new ResearchTeam(); Team3.AddMembers(new Person[3] { new Person("Khrystyna", "Shcherbanik", new DateTime(2000, 04, 30)), new Person("Olga", "Lavruk", new DateTime(2000, 10, 07)), new Person() }); Team3.AddPapers(new Paper[2] { new Paper("Null", new Person("Igor", "Vinnychuk", new DateTime(1985, 11, 1)), new DateTime(2016, 11, 13)), new Paper() }); Console.WriteLine(Team3.getTeamType.ToString()); ResearchTeam Team4 = (ResearchTeam)Team3.DeepCopy(); Team3.NameOfOrganization = "SoftServe"; Team3.ID = 7; Console.WriteLine(Team3.ToString()); Console.WriteLine(Team4.ToString()); foreach (Paper pap in Team3) { Console.WriteLine(pap); } foreach (Person per in Team3.MembersWithoutPublication()) { Console.WriteLine(per); } foreach (Paper pap in Team3.LastPapers(2)) { Console.WriteLine(pap); } Console.ReadKey(); }