public static List <T> Filter <T>(this List <T> sourceList, DelFilter <T> del) { List <T> temp = new List <T>(); foreach (T item in sourceList) { if (del(item)) { temp.Add(item); } } return(temp); }
//public static List<Employee> Filter(this List<Employee> empList, decimal salary) //{ // List<Employee> lstList = new List<Employee>(); // lstList = empList.Where(c => c.Salary > salary).ToList(); // return lstList; //} public static List <T> Filter <T>(this List <T> sourceList, DelFilter <T> del) { List <T> lstList = new List <T>(); foreach (T item in sourceList) { if (del(item)) { lstList.Add(item); } } return(lstList); }