예제 #1
0
        public static void TimedEventTest()
        {
            var timer = new Timer(5);

            var myStudents = new ClassOfStudents();

            // Student has a constuctor for testing
            // subscribing to the testing event TimedEvent
            // printing first and last name on event
            myStudents.AddStudent(new Student("1", "1", timer));
            myStudents.AddStudent(new Student("2", "2"));
            myStudents.AddStudent(new Student("3", "3", timer));

            timer.Run();
        }
예제 #2
0
        public static void TimedEventTest()
        {
            var timer = new Timer(5);

            var myStudents = new ClassOfStudents();

            // Student has a constuctor for testing
            // subscribing to the testing event TimedEvent
            // printing first and last name on event
            myStudents.AddStudent(new Student("1", "1", timer));
            myStudents.AddStudent(new Student("2", "2"));
            myStudents.AddStudent(new Student("3", "3", timer));

            timer.Run();
        }
예제 #3
0
        public static ClassOfStudents ToClassOfStudents <T>(this IEnumerable <T> collection)
            where T : Student
        {
            var output = new ClassOfStudents();

            foreach (dynamic student in collection)
            {
                output.AddStudent(student);
            }

            return(output);
        }