Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        //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);
        }