예제 #1
0
        public static List <Customer> GetCustomers(List <Customer> listOfCustomer, CustomerFilter customerFilter)
        {
            List <Customer> customerListAfterFiltering = new List <Customer>();

            foreach (Customer customer in listOfCustomer)
            {
                if (customerFilter.Invoke(customer))
                {
                    customerListAfterFiltering.Add(customer);
                }
            }

            return(customerListAfterFiltering);
        }
예제 #2
0
        public static ICollection <Customer> GetCustomers(ICollection <Customer> CustomerCollection, CustomerFilter FilterFunction)
        {
            List <Customer> NewCustomerList = new List <Customer>();

            foreach (Customer customer in CustomerCollection)
            {
                if (customer != null)
                {
                    if (customer.ID > 0 || !string.IsNullOrEmpty(customer.Name) || !string.IsNullOrEmpty(customer.Address))
                    {
                        if (FilterFunction.Invoke(customer))
                        {
                            NewCustomerList.Add(customer);
                        }
                    }
                }
            }
            return(NewCustomerList);
        }