static void Main(string[] args) { StudentClass stu = new StudentClass(); stu.Name = "arron"; List <StudentClass> students = new List <StudentClass>(); students.Add(stu); FindName myName = new FindName("arron"); students.Add(new StudentClass("candy")); foreach (var student in students.FindAll(new Predicate <StudentClass>(myName.IsName))) { Console.WriteLine(student); } }
public bool IsName(StudentClass s) { return((s.Name == _name) ? true : false); }