예제 #1
0
 public static IEnumerable <T> Search <T>(this IEnumerable <T> list, IItemSearchCriteria <T> productSearchCriteria)
 {
     foreach (var item in list)
     {
         var tItem = (T)item;
         if (productSearchCriteria.isSatisfiedBy(tItem))
         {
             yield return(tItem);
         }
     }
 }
예제 #2
0
        public MyCollection <T> Search(IItemSearchCriteria <T> productSearchCriteria)
        {
            var result = new MyCollection <T>();

            foreach (var item in _list)
            {
                var tItem = (T)item;
                if (productSearchCriteria.isSatisfiedBy(tItem))
                {
                    result.Add(tItem);
                }
            }
            return(result);
        }
예제 #3
0
 public bool isSatisfiedBy(T item)
 {
     return(!_searchCriteria.isSatisfiedBy(item));
 }