コード例 #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            List <Student> stuList = new List <Student>();

            stuList.Add(new Student("Adam", 33, 23));
            stuList.Add(new Student("Bob", 30, 23));
            stuList.Add(new Student("Charlie", 29, 23));
            stuList.Add(new Student("Dan", 60, 23));


            DelStudent del = new DelStudent(myRules);

            Student.computeclassification(stuList, del);
            void myRules(Student s)
            {
                if (s.Credits == 30)
                {
                    Console.WriteLine(s.Name + " will be a freshman");
                }
                else if (s.Credits == 60)
                {
                    Console.WriteLine(s.Name + " You will be a sophomore");
                }
                else
                {
                    Console.WriteLine(s.Name + " Invalid Data");
                }
            }
        }
コード例 #2
0
 public static void computeclassification(List <Student> stuList, DelStudent del)
 {
     foreach (Student s in stuList)
     {
         del(s);
     }
 }
コード例 #3
0
        private void DelStudents_Click(object sender, EventArgs e)
        {
            DelStudent del = new DelStudent();

            foreach (StudentInfo student in info.GetDebtorsList())
            {
                if (student.NoAttistation >= 3)
                {
                    del.Del(student.ID);
                }
            }

            main.UpdateData();
            UpdateViews();
        }