Esempio n. 1
0
        /// <summary>
        /// 16*. Create a class Group with properties GroupNumber and DepartmentName.
        /// Introduce a property Group in the Student class. Extract all students from "Mathematics" department. Use the Join operator.
        /// </summary>
        static void FindStudentsInMathematicsDepartment()
        {
            Group[] groups = new Group[]
            {
                new Group(15, "Mathematics"),
                new Group(11, "Medicine"),
                new Group(3, "Physics"),
                new Group(1, "Chemistry")
            };

            var result =
                from g in groups
                join s in students on g.DepartmentName equals s.Group.DepartmentName
                where g.DepartmentName == "Mathematics"
                select new { Dep = s.Group.DepartmentName, Name = s.FirstName + " " + s.LastName };

            foreach (var item in result)
            {
                Console.WriteLine(item.Name + " -> " + item.Dep);
            }
        }
Esempio n. 2
0
 public Student(string firstName, string lastName, string fn, string tel, string email, List<int> marks, int groupNumber, Group group)
     :this(firstName, lastName, fn, tel, email, marks, groupNumber)
 {
     this.group = group;
 }