コード例 #1
0
ファイル: TimerTesting.cs プロジェクト: tvmarinov/Homework
        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);
        }