static void Main(string[] args)
        {
            StudentClass sc = new StudentClass("MA_1234", "Mr.Poppins");

            List <Student> list = new List <Student>()
            {
                new Student("X00IP", "Michael", "Male"),
                new Student("X00QW", "Conor", "Male"),
                new Student("X00MS", "Heath", "Male"),
                new Student("X00RT", "Jasmine", "Female")
            };

            foreach (var item in list)
            {
                sc.AddStudent(item);
            }

            //Console.WriteLine($"{sc} {sc["LL999"]}");
            Console.WriteLine($"{sc}{sc[3]}");
        }
示例#2
0
        static void Main(string[] args)
        {
            List <Student> studentList = new List <Student>
            {
                new Student("X00146", "Michael", "Male"),
                new Student("X00147", "Peter", "Male"),
                new Student("X00148", "Nial", "Male"),
                new Student("X00149", "Harry", "Male"),
            };

            StudentClass classroom = new StudentClass("CRN-125", "Mr.Higgins");

            Console.WriteLine(classroom);

            foreach (var item in studentList)
            {
                Console.WriteLine(item);
                classroom.AddStudent(item);
                Console.WriteLine("--------------");
            }
        }