Beispiel #1
0
        public static void MultiList()
        {
            StudentList mary = new StudentList()
            {
                Name = "mary",
                Age  = 11
            };
            StudentList mike = new StudentList()
            {
                Name = "mike",
                Age  = 12
            };
            StudentList john = new StudentList()
            {
                Name = "john",
                Age  = 13
            };
            CourseList chinese = new CourseList()
            {
                Name    = "Chinese",
                Teacher = "欧阳胜利"
            };
            CourseList english = new CourseList()
            {
                Name    = "English",
                Teacher = "东方建设"
            };
            CourseList math = new CourseList()
            {
                Name    = "Math",
                Teacher = "西门建国"
            };

            chinese.Enroll(mary);
            chinese.Enroll(mike);
            chinese.Enroll(john);

            english.Enroll(mike);

            math.Enroll(mary);
            math.Enroll(john);

            System.Console.WriteLine("mary:");
            mary.PrintList();
            System.Console.WriteLine("mike:");
            mike.PrintList();
            System.Console.WriteLine("john:");
            john.PrintList();
            System.Console.WriteLine("chinese:");
            chinese.PrintList();
            System.Console.WriteLine("english:");
            english.PrintList();
            System.Console.WriteLine("math:");
            math.PrintList();
        }