Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Student_Select student_Select = new Student_Select(_StudentList.男生);                                 //委託傳遞的方法(邏輯),()裡 可以抽換邏輯,可以新增,不用修改
            var            result         = _StudentList.Get_result(_StudentList.Get_newlist(), student_Select); //查詢結果(查詢清單,邏輯)

            _StudentList.show(result);
        }
Beispiel #2
0
        //查詢
        public List <Student> Get_result(List <Student> source, Student_Select student_Select)
        {
            List <Student> studentLists = new List <Student>();

            foreach (var student in source)
            {
                if (student_Select.Invoke(student))
                {
                    studentLists.Add(student);
                }
            }
            return(studentLists);
        }