public static void getAge(List <Student> list, AgeDelegate t) { foreach (Student item in list) { if (t(item)) { Console.WriteLine(item); } } }
static IEnumerable <MyObject> AgeCheck(List <MyObject> people, AgeDelegate checkAge) { foreach (MyObject person in people) { if (checkAge(person.Age)) { yield return(person); } } }
//A method that take your age and do some logics with it return the result static bool AgeLogicResult(float age, AgeDelegate AgeLogic) { bool isResult = AgeLogic(age); return(isResult); }